Plugin Directory

Changeset 355286


Ignore:
Timestamp:
03/04/2011 05:14:40 PM (15 years ago)
Author:
Patrick Brouwer
Message:

1.6

Location:
simple-portfolio/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • simple-portfolio/trunk/extends/init.php

    r282765 r355286  
    3232        'menu_position'     => 20,
    3333        'menu_icon'         => WP_PLUGIN_URL . '/simple-portfolio/images/icon.jpg',
    34         'supports'          => array('title', 'editor', 'comments')
     34        'supports'          => array('title', 'editor', 'comments', 'thumbnail')
    3535    );
    3636   
  • simple-portfolio/trunk/extends/rewrite.php

    r275391 r355286  
    1515    $newrules[$info->rewrite['slug'].'/page/?([0-9]{1,})/?$'] = 'index.php?post_type='.$info->name.'&paged=$matches[1]';
    1616   
    17     if (get_option('use-xml') == '1')
     17    if (get_option('use-xml') != '0')
    1818        $newrules[$info->rewrite['slug'].'.xml/?$'] =  'index.php?post_type='.$info->name.'&portfolio_data=xml';
    1919   
  • simple-portfolio/trunk/extends/settings-panel.php

    r282589 r355286  
    4242            ?>
    4343                <p>When enabled, <?php echo "<a href=\"$xml_url\" target=\"_blank\">" . $xml_url . "</a>"; ?> generates the xml.</p>
    44                 <label for="use-xml">
    45                     <input type="checkbox" <?php echo (get_option('use-xml') == '1') ? "checked=\"checked\"" : ''; ?> value="1" id="comments_notify" name="use-xml">
    46                     Enable xml output
    47                 </label>
     44                <p>
     45                    <label title="dont use xml">
     46                        <input type="radio" value="0" name="use-xml" <?php echo (get_option('use-xml') == '0') ? "checked=\"checked\"" : ""; ?>" >
     47                        <span>Disabled</span>
     48                    </label>
     49                </p>
     50                <p>
     51                    <label title="generate only portfolio data">
     52                        <input type="radio" value="1" name="use-xml" <?php echo (get_option('use-xml') == '1') ? "checked=\"checked\"" : ""; ?>" >
     53                        <span>Enabled &gt; Portfolio Data</span>
     54                    </label>
     55                </p>
     56                <p>
     57                    <label title="generate portfolio and all wordpress data">
     58                        <input type="radio" value="2" name="use-xml" <?php echo (get_option('use-xml') == '2') ? "checked=\"checked\"" : ""; ?>" >
     59                        <span>Enabled &gt; All Data (including WP data such as pages, posts, custom menu's, categories and links) </span>
     60                    </label>
     61                </p>
    4862            <?php
    4963                else:
  • simple-portfolio/trunk/extends/xml.php

    r282589 r355286  
    11<?php
    2 
    32/**
    4 * Outputs a valid xml with all portfolio projects.
     3* Outputs a valid xml with all wordpress data you need included portfolio projects.
    54* Images imported from Media Library are listed in each available (crunched) size
    65*/
     6
     7    /**
     8    * Extract the base path out of the current path
     9    */
     10    function hide_server_url( $path ) {
     11        $site_url = get_site_url();
     12        if (substr($path, 0, strlen($site_url)) != $site_url) return $path;
     13   
     14        $trimmed = substr($path, strlen($site_url));
     15        while (substr($trimmed,0,1) == '/') $trimmed = substr($trimmed,1);
     16        while (substr($trimmed, strlen($trimmed)-1) == '/') $trimmed = substr($trimmed, 0, strlen($trimmed)-1);
     17   
     18        return $trimmed;
     19    }
     20   
    721header ("content-type: text/xml");
     22echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
     23
    824$projects = simple_portfolio_query_projects();
    925
    10 echo "<?xml version=\"1.0\"?>\n";
    1126?>
    12 <portfolio>
    13     <projects>
    14 <?php
    15     while (have_posts()) : the_post();
    16         $image_media = simple_portfolio_media(get_the_ID(), 'image');
    17         $youtube_media = simple_portfolio_media(get_the_ID(), 'youtube');
    18         $snippet_media = simple_portfolio_media(get_the_ID(), 'snippet');
    19         $text_media = simple_portfolio_media(get_the_ID(), 'text');
     27<wordpress>
     28    <portfolio>
     29        <projects>
     30    <?php
     31        while (have_posts()) : the_post();
     32            $image_media = simple_portfolio_media(get_the_ID(), 'image');
     33            $youtube_media = simple_portfolio_media(get_the_ID(), 'youtube');
     34            $snippet_media = simple_portfolio_media(get_the_ID(), 'snippet');
     35            $text_media = simple_portfolio_media(get_the_ID(), 'text');
    2036       
    21         $categories = '';
    22         foreach (wp_get_post_terms(get_the_ID(), 'portfolio-categories', array('orderby' => 'id')) as $tax) $categories .= $tax->term_id . ',';
    23         $categories = rtrim($categories, ',');
     37            $categories = '';
     38            foreach (wp_get_post_terms(get_the_ID(), 'portfolio-categories', array('orderby' => 'id')) as $tax) $categories .= $tax->term_id . ',';
     39            $categories = rtrim($categories, ',');
    2440       
    25         $clients = '';
    26         foreach (wp_get_post_terms(get_the_ID(), 'portfolio-clients', array('orderby' => 'id')) as $tax) $clients .= $tax->term_id . ',';
    27         $clients = rtrim($clients, ',');
     41            $clients = '';
     42            foreach (wp_get_post_terms(get_the_ID(), 'portfolio-clients', array('orderby' => 'id')) as $tax) $clients .= $tax->term_id . ',';
     43            $clients = rtrim($clients, ',');
    2844       
    29         $tags = '';
    30         foreach (wp_get_post_terms(get_the_ID(), 'portfolio-tags', array('orderby' => 'id')) as $tax) $tags .= $tax->term_id . ',';
    31         $tags = rtrim($tags, ',');
     45            $tags = '';
     46            foreach (wp_get_post_terms(get_the_ID(), 'portfolio-tags', array('orderby' => 'id')) as $tax) $tags .= $tax->term_id . ',';
     47            $tags = rtrim($tags, ',');
    3248       
    33 ?>
    34     <project id="<?php the_ID(); ?>" categories="<?php echo $categories; ?>" clients="<?php echo $clients; ?>" tags="<?php echo $tags; ?>">
    35         <title><![CDATA[<?php the_title(); ?>]]></title>
    36         <description><![CDATA[<?php echo preg_replace('/<!--more-->/', '', get_post(get_the_id())->post_content); ?>]]></description>
    37         <media>
    38                 <?php /** images */ ?>
    39                 <?php foreach ($image_media as $image_id): ?>
    40                     <image>
    41                         <?php foreach (array('thumbnail', 'medium', 'large', 'full') as $image_size): $image = wp_get_attachment_image_src($image_id['value'], $image_size); ?>
    42                             <<?php echo $image_size; ?> width="<?php echo $image[1]; ?>" height="<?php echo $image[2]; ?>" src="<?php echo $image[0]; ?>" />
    43                         <?php endforeach; ?>
    44                     </image>
     49    ?>
     50        <project id="<?php the_ID(); ?>" categories="<?php echo $categories; ?>" clients="<?php echo $clients; ?>" tags="<?php echo $tags; ?>">
     51            <title><![CDATA[<?php the_title(); ?>]]></title>
     52            <date_created><![CDATA[<?php echo get_post(get_the_id())->post_date; ?>]]></date_created>
     53            <date_modified><![CDATA[<?php echo get_post(get_the_id())->post_modified; ?>]]></date_modified>
     54            <description><![CDATA[<?php echo preg_replace('/<!--more-->/', '', get_post(get_the_id())->post_content); ?>]]></description>
     55            <media>
     56                    <?php /** images */ ?>
     57                    <?php foreach ($image_media as $image_id): ?>
     58                        <image>
     59                            <?php foreach (array('thumbnail', 'medium', 'large', 'full') as $image_size): $image = wp_get_attachment_image_src($image_id['value'], $image_size); ?>
     60                                <<?php echo $image_size; ?> width="<?php echo $image[1]; ?>" height="<?php echo $image[2]; ?>" src="<?php echo $image[0]; ?>" />
     61                            <?php endforeach; ?>
     62                        </image>
     63                    <?php endforeach; ?>
     64               
     65                    <?php /** youtube */ ?>
     66                    <?php foreach ($youtube_media as $youtube_id): ?>
     67                        <youtube id="<?php echo $youtube_id['value']; ?>" />
     68                    <?php endforeach; ?>
     69               
     70                    <?php /** snippet */ ?>
     71                    <?php foreach ($snippet_media as $snippet): ?>
     72                        <snippet><![CDATA[<?php echo $snippet['value']; ?>]]></snippet>
     73                    <?php endforeach; ?>
     74               
     75                    <?php /** text */ ?>
     76                    <?php foreach ($text_media as $text): ?>
     77                        <text><![CDATA[<?php echo $text['value']; ?>]]></text>
     78                    <?php endforeach; ?>
     79            </media>
     80            <information>
     81                <?php foreach (simple_portfolio_info() as $tag=>$info): preg_match('/_([a-zA-Z0-9]+)/', $tag, $tag); ?>
     82                <<?php echo $tag[1]; ?>><![CDATA[<?php echo $info; ?>]]></<?php echo $tag[1]; ?>>
    4583                <?php endforeach; ?>
    46                
    47                 <?php /** youtube */ ?>
    48                 <?php foreach ($youtube_media as $youtube_id): ?>
    49                     <youtube id="<?php echo $youtube_id['value']; ?>" />
    50                 <?php endforeach; ?>
    51                
    52                 <?php /** snippet */ ?>
    53                 <?php foreach ($snippet_media as $snippet): ?>
    54                     <snippet><![CDATA[<?php echo $snippet['value']; ?>]]></snippet>
    55                 <?php endforeach; ?>
    56                
    57                 <?php /** text */ ?>
    58                 <?php foreach ($text_media as $text): ?>
    59                     <text><![CDATA[<?php echo $text['value']; ?>]]></text>
    60                 <?php endforeach; ?>
    61         </media>
    62         <information>
    63             <?php foreach (simple_portfolio_info() as $tag=>$info): preg_match('/_([a-zA-Z0-9]+)/', $tag, $tag); ?>
    64             <<?php echo $tag[1]; ?>><![CDATA[<?php echo $info; ?>]]></<?php echo $tag[1]; ?>>
     84            </information>
     85        </project>
     86   
     87    <?php endwhile; ?>
     88        </projects>
     89   
     90        <?php /** clients */ ?>
     91        <clients>
     92            <?php $clients = get_terms('portfolio-clients', array('orderby' => 'id')); ?>
     93            <?php foreach ($clients as $client): ?>
     94                <client id="<?php echo $client->term_id; ?>" link="<?php echo get_term_link($client->slug, $client->taxonomy); ?>">
     95                    <title><![CDATA[<?php echo $client->name; ?>]]></title>
     96                    <description><![CDATA[<?php echo preg_replace('/<!--more-->/', '', $client->description); ?>]]></description>
     97                </client>
    6598            <?php endforeach; ?>
    66         </information>
    67     </project>
     99        </clients>
    68100   
    69 <?php endwhile; ?>
    70     </projects>
     101        <?php /** categories */ ?>
     102        <categories>
     103            <?php $cats = get_terms('portfolio-categories', array('orderby' => 'id')); ?>
     104            <?php foreach ($cats as $cat): ?>
     105                <category id="<?php echo $cat->term_id; ?>" link="<?php echo get_term_link($cat->slug, $cat->taxonomy); ?>">
     106                    <title><![CDATA[<?php echo $cat->name; ?>]]></title>
     107                    <description><![CDATA[<?php echo preg_replace('/<!--more-->/', '', $cat->description); ?>]]></description>
     108                </category>
     109            <?php endforeach; ?>
     110        </categories>
    71111   
    72     <?php /** clients */ ?>
    73     <clients>
    74         <?php $clients = get_terms('portfolio-clients', array('orderby' => 'id')); ?>
    75         <?php foreach ($clients as $client): ?>
    76             <client id="<?php echo $client->term_id; ?>" link="<?php echo get_term_link($client->slug, $client->taxonomy); ?>">
    77                 <title><![CDATA[<?php echo $client->name; ?>]]></title>
    78                 <description><![CDATA[<?php echo preg_replace('/<!--more-->/', '', $client->description); ?>]]></description>
    79             </client>
     112        <?php /** tags */ ?>
     113        <tags>
     114            <?php $tags = get_terms('portfolio-tags', array('orderby' => 'id')); ?>
     115            <?php foreach ($tags as $tag): ?>
     116                <tag id="<?php echo $tag->term_id; ?>" link="<?php echo get_term_link($tag->slug, $tag->taxonomy); ?>">
     117                    <title><![CDATA[<?php echo $tag->name; ?>]]></title>
     118                    <description><![CDATA[<?php echo preg_replace('/<!--more-->/', '', $tag->description); ?>]]></description>
     119                </tag>
     120            <?php endforeach; ?>
     121        </tags>
     122   
     123    </portfolio>
     124   
     125<?php if (get_option('use-xml') == '2'): ?>
     126    <menus>
     127        <?php
     128        $menus = wp_get_nav_menus();
     129        $menu_items = wp_get_nav_menu_items($menus[0]);
     130        foreach ($menu_items as $menu_item): ?>
     131            <menu url="<?php echo hide_server_url($menu_item->url); ?>">
     132                <title><![CDATA[<?php echo $menu_item->title; ?>]]></title>
     133                <description><![CDATA[<?php echo $menu_item->description; ?>]]></description>
     134            </menu>
    80135        <?php endforeach; ?>
    81     </clients>
     136    </menus>
     137    <pages>
    82138   
    83     <?php /** categories */ ?>
     139        <?php query_posts('post_type=page&orderby=menu_order&post_status=publish'); while (have_posts()) : the_post(); $post = get_post(get_the_id()); ?>
     140            <page id="<?php the_ID(); ?>" path="<?php echo hide_server_url(get_permalink()); ?>" template="<?php echo get_post_meta($post->ID,'_wp_page_template',true); ?>">
     141                <title><![CDATA[<?php echo $post->post_title; ?>]]></title>
     142                <date_created><![CDATA[<?php echo $post->post_date; ?>]]></date_created>
     143                <date_modified><![CDATA[<?php echo $post->post_modified; ?>]]></date_modified>
     144                <excerpt><![CDATA[<?php echo $post->post_excerpt; ?>]]></excerpt>
     145                <content><![CDATA[<?php echo $post->post_content; ?>]]></content>
     146                <meta>
     147                <?php foreach (get_post_custom($post->ID) as $key => $value): if (substr($key,0,1) != '_'): ?>
     148                    <value id="<?php echo $key; ?>"><![CDATA[<?php echo $value[0]; ?>]]></value>
     149                <?php endif; endforeach; ?>
     150                </meta>
     151                <featured_image><![CDATA[<?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo $large_image_url[0]; ?>]]></featured_image>
     152            </page>
     153        <?php endwhile; ?>
     154       
     155    </pages>
     156    <links>
     157   
     158        <?php foreach (get_bookmarks() as $bookmark): ?>
     159            <link url="<?php echo $bookmark->link_url; ?>" target="<?php echo $bookmark->link_target; ?>">
     160                <title><![CDATA[<?php echo $bookmark->link_name; ?>]]></title>
     161                <description><![CDATA[<?php echo $bookmark->link_description; ?>]]></description>
     162            </link>
     163        <?php endforeach; ?>
     164       
     165    </links>
    84166    <categories>
    85         <?php $cats = get_terms('portfolio-categories', array('orderby' => 'id')); ?>
    86         <?php foreach ($cats as $cat): ?>
    87             <category id="<?php echo $cat->term_id; ?>" link="<?php echo get_term_link($cat->slug, $cat->taxonomy); ?>">
    88                 <title><![CDATA[<?php echo $cat->name; ?>]]></title>
    89                 <description><![CDATA[<?php echo preg_replace('/<!--more-->/', '', $cat->description); ?>]]></description>
     167   
     168        <?php $categories = get_categories( array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'child_of' => 0, 'hierarchical' => true, 'depth' => 0, 'current_category' => 0, 'taxonomy' => 'category') );
     169        foreach ($categories as $category): ?>
     170            <category path="category/<?php echo $category->slug; ?>">
     171                <title><![CDATA[<?php echo $category->name; ?>]]></title>
     172                <description><![CDATA[<?php echo $category->description; ?>]]></description>
     173                <posts>
     174                <?php wp_reset_query(); query_posts('post_type=post&orderby=menu_order&post_status=publish&cat=' . $category->cat_ID ); while (have_posts()) : the_post(); $post = get_post(get_the_id()); ?>
     175                    <post id="<?php the_ID(); ?>" path="<?php echo hide_server_url(get_permalink()); ?>">
     176                        <title><![CDATA[<?php echo $post->post_title; ?>]]></title>
     177                        <date_created><![CDATA[<?php echo $post->post_date; ?>]]></date_created>
     178                        <date_modified><![CDATA[<?php echo $post->post_modified; ?>]]></date_modified>
     179                        <excerpt><![CDATA[<?php echo $post->post_excerpt; ?>]]></excerpt>
     180                        <content><![CDATA[<?php echo $post->post_content; ?>]]></content>
     181                        <meta>
     182                        <?php foreach (get_post_custom($post->ID) as $key => $value): if (substr($key,0,1) != '_'): ?>
     183                            <value id="<?php echo $key; ?>"><![CDATA[<?php echo $value[0]; ?>]]></value>
     184                        <?php endif; endforeach; ?>
     185                        </meta>
     186                    </post>
     187                <?php endwhile; ?>
     188                </posts>
    90189            </category>
    91         <?php endforeach; ?>
     190        <?php endforeach;?>
     191       
    92192    </categories>
    93    
    94     <?php /** tags */ ?>
    95     <tags>
    96         <?php $tags = get_terms('portfolio-tags', array('orderby' => 'id')); ?>
    97         <?php foreach ($tags as $tag): ?>
    98             <tag id="<?php echo $tag->term_id; ?>" link="<?php echo get_term_link($tag->slug, $tag->taxonomy); ?>">
    99                 <title><![CDATA[<?php echo $tag->name; ?>]]></title>
    100                 <description><![CDATA[<?php echo preg_replace('/<!--more-->/', '', $tag->description); ?>]]></description>
    101             </tag>
    102         <?php endforeach; ?>
    103     </tags>
    104    
    105 </portfolio>
     193<?php endif; ?>
    106194
     195</wordpress>
     196
  • simple-portfolio/trunk/readme.txt

    r318037 r355286  
    55Tags: page, post, pages, posts, images, youtube, image, jpg, jpeg, picture, pictures, photos, portfolio, showcase, custom, clients, tags, categories.
    66Requires at least: 2.8
    7 Tested up to: 3.0.2
    8 Stable tag: 1.5
     7Tested up to: 3.1
     8Stable tag: 1.6
    99
    1010Simple Portfolio allows you to easily manage your portfolio. You can append snippets, youtube and media from the built-in Media Library to projects.
     
    3232== Frequently Asked Questions ==
    3333
    34 = Where are my media saved? =
    35 
    36 Simple-portfolio only saves references of media to project meta data. This plugin uses the built in Media Library for uploads and storage.
    37 
    38 = Portfolio items doesn't show up in my theme =
     34= Where does this plugin save my media? =
     35
     36The cool thing is that this plugin doesn't create extra tables in database or do other arbitrary stuff. Simple-portfolio only saves references of media to project meta data. This plugin uses the built in Media Library for uploads and storage.
     37
     38= Can't show my projects? =
    3939
    4040Simple-portfolio provides a small set of methods that can easily be implemented in your theme. Watch the [screencast](http://projects.inlet.nl/simple-portfolio-wordpress3/screencast/) for an example.
     
    6363</code>
    6464
     65= I'm totally stuck! What now? =
     66
     67Have you checked the [screencast](http://projects.inlet.nl/simple-portfolio-wordpress3/screencast/) already? And have you studied the [API an Usage](http://wordpress.org/extend/plugins/simple-portfolio/other_notes/)? If not then don't hesitate to contact me!
    6568
    6669== Screenshots ==
     
    8083== Changelog ==
    8184
     85= 1.6 =
     86
     87* added date 'created/modified' to portfolio xml
     88* added more xml features to settings>portfolio, you can now choose what type of data is included in the xml.
     89* Option to include all WP data in xml.
     90* Added featured image (post thumbnails for projects)
     91
    8292= 1.5 =
    8393
  • simple-portfolio/trunk/simple-portfolio.php

    r318037 r355286  
    44Plugin URI: http://projects.inlet.nl/simple-portfolio-wordpress3/
    55Description: Manage your portfolio projects easily and use them everywhere you like. This plugin is very simple to use, it doesn't bother you with a complex user interface. Add project specific information, for example what your role was and the team you've worked in, etc. Add any media you like: YouTube, code snippets or any media from your wordpress built-in Media Library. Wonder how it works? Watch the <a href="http://www.inlet.nl">screencast</a>.
    6 Version: 1.5
     6Version: 1.6
    77Author: Patrick Brouwer (Inlet)
    88Author URI: http://www.inlet.nl
Note: See TracChangeset for help on using the changeset viewer.