WordPress.org

Plugin Directory

Changeset 657057


Ignore:
Timestamp:
01/22/13 19:59:58 (15 months ago)
Author:
joedolson
Message:

Version 1.3.0 upgrade: adds support for creating/managing custom fields.

Location:
my-content-management/trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • my-content-management/trunk/mcm-custom-posts.php

    r618073 r657057  
    4040                'has_archive' => true, 
    4141                'supports' => $raw['supports'] 
     42                //'map_meta_cap'=>true, 
     43                //'capability_type'=>array( $value[4],$value[3] ) 
    4244            );  
    4345            register_post_type($key,$args); 
     
    99101    if ( is_array($fields) ) { 
    100102        foreach ( $fields as $key=>$value ) { 
    101             mcm_add_custom_box( array($key=>$value),$extras[$key][0],$extras[$key][1] ); 
     103            if ( isset($extras[$key]) && is_array( $extras[$key][0] ) ) { 
     104                foreach ( $extras[$key][0] as $k ) { 
     105                    mcm_add_custom_box( array($key=>$value),$k,$extras[$key][1] ); 
     106                }  
     107            } else { 
     108                if ( isset( $extras[$key] ) ) { 
     109                    mcm_add_custom_box( array($key=>$value),$extras[$key][0],$extras[$key][1] ); 
     110                } 
     111            } 
    102112        } 
    103113    } 
     
    108118    if ( function_exists( 'add_meta_box' ) ) { 
    109119        foreach ( array_keys( $fields ) as $field ) { 
    110             add_meta_box( $field, __( $field, 'sp' ), 'mcm_build_custom_box', $post_type, $location, 'default', $fields ); 
     120            //$id = sanitize_title($field); 
     121            add_meta_box( $field, $field, 'mcm_build_custom_box', $post_type, $location, 'default', $fields ); 
    111122            //echo "$field, $post_type, $location, $fields"; 
    112123        } 
     
    117128    static $nonce_flag = false; 
    118129    // Run once 
     130    echo "<div class='mcm_post_fields'>"; 
    119131    if ( !$nonce_flag ) { 
    120132        mcm_echo_nonce(); 
     
    127139        echo mcm_field_html( $field ); 
    128140        $i++; 
    129     }    
     141    } 
     142    echo "<br class='clear' /></div>"; 
    130143} 
    131144// this switch statement specifies different types of meta boxes 
     
    136149        case 'textarea': 
    137150            return mcm_text_area( $args ); 
     151        case 'select': 
     152            return mcm_select( $args );      
    138153        default: 
    139             return mcm_text_field( $args ); 
    140     } 
    141 } 
     154            return mcm_text_field( $args, $args[3] ); 
     155    } 
     156} 
     157 
     158function mcm_create_options( $choices, $selected, $type='select' ) { 
     159    $return = ''; 
     160    if (is_array($choices) ) { 
     161        foreach($choices as $value ) { 
     162            $v = esc_attr($value); 
     163            if ( $type == 'select' ) { 
     164                $chosen = ( $v == $selected )?' selected="selected"':''; 
     165                $return .= "<option value='$value'$chosen>$value</option>"; 
     166            }  
     167        } 
     168    } 
     169    return $return; 
     170} 
     171 
    142172add_action( 'save_post', 'mcm_save_postdata', 1, 2 ); 
    143173// this is the default text field meta box 
    144 function mcm_text_field( $args ) { 
     174function mcm_text_field( $args, $type='text' ) { 
     175    $types = array( 'color','date','number','tel','time','url' ); 
     176    if ( $type == 'mcm_text_field' ) { $type = 'text'; } else { $type = ( in_array( $type, $types ) )?$type:'text'; } 
    145177    global $post; 
    146178    $description = $args[2]; 
     
    149181    $args[1] = __($args[1], 'sp' ); 
    150182    $label_format = 
    151         '<p><label for="%1$s"><strong>%2$s</strong></label></p>'. 
    152         '<p><input style="width: 80%%;" type="text" name="%1$s" value="%3$s" /></p>'; 
    153         if ( $description != '' ) { $label_format .= '<p><em>'.$description.'</em></p>'; } 
     183        '<p class="mcm_text_field mcm_field"><label for="%1$s"><strong>%2$s</strong></label><br />'. 
     184        '<input style="width: 80%%;" type="text" name="%1$s" value="%3$s" id="%1$s" />'; 
     185        if ( $description != '' ) { $label_format .= '<br /><em>'.$description.'</em></p>'; } else { $label_format .= '</p>'; } 
     186        return vsprintf( $label_format, $args ); 
     187} 
     188 
     189function mcm_select( $args ) { 
     190        global $post; 
     191        $choices = $args[2]; 
     192        $custom = get_post_meta( $post->ID, $args[0], true ); 
     193        $label_format = '<p class="mcm_select mcm_field"><label for="%1$s"><strong>%2$s</strong></label><br />'. 
     194        '<select name="%1$s" id="%1$s">'. 
     195            mcm_create_options( $choices, $custom ). 
     196        '</select></p>'; 
    154197        return vsprintf( $label_format, $args ); 
    155198} 
     
    163206    $args[1] = __($args[1], 'sp' ); 
    164207    $label_format = 
    165         '<p><label for="%1$s"><strong>%2$s</strong></label></p>'. 
    166         '<p><textarea style="width: 90%%;" name="%1$s">%3$s</textarea></p>'; 
    167         if ( $description != '' ) { $label_format .= '<p><em>'.$description.'</em></p>'; } 
     208        '<p class="mcm_textarea mcm_field"><label for="%1$s"><strong>%2$s</strong></label><br />'. 
     209        '<textarea style="width: 90%%;" name="%1$s">%3$s</textarea>'; 
     210        if ( $description != '' ) { $label_format .= '<br /><em>'.$description.'</em></p>'; } else { $label_format .= '</p>'; } 
    168211    return vsprintf( $label_format, $args ); 
    169212} 
     
    276319        array ( 
    277320            array( '_title', __('Title','my-content-management'), '','mcm_text_field'), 
    278             array( '_subtitle',__('Subtitle','my-content-management'),'','mcm_text_field'), 
     321            array( '_subtitle',__('Subtitle','my-content-management'), '','mcm_text_field'), 
    279322            array( '_business',__('Business','my-content-management'),'','mcm_text_field' ), 
    280             array( '_phone', __('Phone Number','my-content-management'), '','mcm_text_field'), 
    281             array( '_email', __('E-mail','my-content-management'), '', 'mcm_text_field') 
     323            array( '_phone', __('Phone Number','my-content-management'), '','tel'), 
     324            array( '_email', __('E-mail','my-content-management'), '', 'email') 
    282325        ), 
    283326        __('Location Info','my-content-management') => 
     
    289332            array( '_country',__('Country','my-content-management'),'','mcm_text_field'), 
    290333            array( '_postalcode',__('Postal Code','my-content-management'),'','mcm_text_field'),                 
    291             array( '_phone',__('Phone','my-content-management'),'','mcm_text_field'), 
     334            array( '_phone',__('Phone','my-content-management'),'','tel'), 
    292335            array( '_fax',__('Fax','my-content-management'),'','mcm_text_field'), 
    293336            array( '_business',__('Business Name','my-content-management'),'','mcm_text_field'), 
    294             array( '_email',__('Contact Email','my-content-management'),'','mcm_text_field') 
     337            array( '_email',__('Contact Email','my-content-management'),'','email') 
    295338        ), 
    296339        __('Quotation Info','my-content-management') => 
    297340        array ( 
    298             array( '_url',__('URL','my-content-management'),'','mcm_text_field'), 
     341            array( '_url',__('URL','my-content-management'),'','url'), 
    299342            array( '_title',__('Title','my-content-management'),'','mcm_text_field'), 
    300343            array( '_location',__('Location','my-content-management'),'','mcm_text_field')       
     
    302345        __('Testimonial Info','my-content-management') => 
    303346        array ( 
    304             array( '_url',__('URL','my-content-management'),'','mcm_text_field'), 
     347            array( '_url',__('URL','my-content-management'),'','url'), 
    305348            array( '_title',__('Title','my-content-management'),'','mcm_text_field'), 
    306349            array( '_location',__('Location','my-content-management'),'','mcm_text_field')       
  • my-content-management/trunk/mcm-styles.css

    r576432 r657057  
    1 #support { background:#fff; padding: 15px 15px 5px; margin: 10px; border-radius: 10px; float: right; border: 1px solid #bbb; box-shadow: 1px 1px 6px #aaa; text-align: center } 
    2 .mcm-settings { margin-right: 250px; } 
    31.mcm-settings legend { font-weight: 700; font-size: 1.1em;} 
    42.wrappers { width: 16em; float: left; padding-top: 1em; } 
    53.wrappers label { display: block; float: left; width: 7em; padding: 5px 0 0;} 
    6 .mcm-template-guide{ width: 230px; float: right;} 
    74.extra_fields{ float: right; padding: 10px; width: 200px; } 
    85.mcm_edit_post_type { -moz-column-count: 2; -webkit-column-count: 2; column-count: 2; background: #fefefe; padding: 15px; border: 1px solid #ddd; -moz-border-radius: 5px; height: 22em;} 
    96.mcm_edit_post_type p { line-height: 1.2; margin: 4px 0!important;} 
    10 .buy a { padding: 10px; -moz-box-shadow: 1px 1px 2px #333; -webkit-box-shadow: 1px 1px 2px #333; box-shadow: 1px 1px 2px #333; font-weight: 700; display: block; background: #fefdaa; font-size: 1.1em;  } 
     7#support { text-align: center; } 
     8.buy a { padding: 6px; display:block;border-radius: 4px; box-shadow: 1px 1px 2px #666; font-weight: 700; display: block; background: #fefdaa; font-size: 1.1em;  } 
     9#mcm-settings legend { display: block; float: left; padding: 0; width: 12.5em; font-weight: 400;  font-size: 1em; } 
     10.mcm_customfields li { margin: 0 0 2px; background: #f3f3f3; padding: 3px 0; } 
     11.mcm-settings .postbox { margin: 10px 10px 0 0; } 
     12.mcm-settings .meta-box-sortables { min-height: 0; } 
     13.mcm-settings td label { position: absolute; left: -999em; }  
     14.mcm-settings td input { width: 100%; } 
  • my-content-management/trunk/mcm-view-custom-posts.php

    r618073 r657057  
    134134            $p['excerpt_raw'] = get_the_excerpt(); 
    135135            remove_filter('the_content','mcm_replace_content'); 
    136             $p['content'] = apply_filters('the_content',get_the_content() ); 
     136            $p['content'] = apply_filters('the_content',get_the_content(), get_the_ID() ); 
    137137            add_filter('the_content','mcm_replace_content'); 
    138138            $p['content_raw'] = get_the_content(); 
     
    146146            $p['fulldate'] = get_the_time( 'F j, Y' ); 
    147147            $p['author'] = get_the_author(); 
     148            $p['edit_link'] = get_edit_post_link($id) ? "<a href='".get_edit_post_link($id)."'>".__( 'Edit', 'my-content-management' )."</a>" : "";  
    148149                $postclass = implode( ' ',get_post_class() ); 
    149150            $p['postclass'] = $postclass; 
     
    151152            $custom_fields = get_post_custom(); 
    152153                foreach ( $custom_fields as $key=>$value ) { 
     154                    $is_email = ( stripos( $key, 'email' ) !== false )?true:false; 
    153155                    if ( is_array( $value ) ) { 
    154156                        if ( is_array( $value[0] ) ) { 
    155                             $p[$key] = explode( ", ", $value[0] ); 
     157                            foreach( $value[0] as $val ) { 
     158                                $cfield[] = ( $is_email )?apply_filters('mcm_munge',$val,$val, $custom ):$val; 
     159                            } 
     160                            $p[$key] = explode( ", ", $cfield ); 
    156161                        } else { 
    157                             $p[$key] = $value[0]; 
     162                            $p[$key] = ( $is_email )?apply_filters('mcm_munge',$value[0],$value[0], $custom ):$value[0]; 
    158163                        } 
    159164                    } 
    160165                } 
    161             if ( isset($p['_email']) ) { $p['_email'] = apply_filters('mcm_munge',$p['_email'], $p['_email'], $custom ); } 
    162166            // use this filter to insert any additional custom template tags required        
    163167            $p = apply_filters('mcm_extend_posts', $p, $p, $custom ); 
     
    184188            //$p['content'] = do_shortcode( wpautop( $the_post->post_content ) ); 
    185189            remove_filter('the_content','mcm_replace_content'); 
    186             $p['content'] = apply_filters('the_content', $the_post->post_content );  
     190            $p['content'] = apply_filters('the_content', $the_post->post_content, $the_post->ID );   
    187191            add_filter('the_content','mcm_replace_content'); 
    188192            $p['content_raw'] = $the_post->post_content; 
     
    199203            $p['fulldate'] = date( 'F j, Y', strtotime( $the_post->post_date ) );        
    200204            $p['author'] = get_the_author_meta( 'display_name', $the_post->post_author ); 
    201                 $postclass = implode( ' ',get_post_class( '',$the_post->ID ) ); 
     205            $p['edit_link'] = get_edit_post_link($the_post->ID) ? "<a href='".get_edit_post_link($the_post->ID)."'>".__( 'Edit', 'my-content-management' )."</a>" : ""; 
     206            $postclass = implode( ' ',get_post_class( '',$the_post->ID ) ); 
    202207            $p['postclass'] = $postclass;                
    203208            $p['terms'] = ($taxonomy != 'all')?get_the_term_list( $the_post->ID, $taxonomy,'',', ','' ):''; 
    204209            $custom_fields = get_post_custom( $the_post->ID ); 
    205210                foreach ( $custom_fields as $key=>$value ) { 
     211                    $is_email = ( stripos( $key, 'email' ) !== false )?true:false; 
    206212                    if ( is_array( $value ) ) { 
    207213                        if ( is_array( $value[0] ) ) { 
    208                             $p[$key] = explode( ", ", $value[0] ); 
     214                            foreach( $value[0] as $val ) { 
     215                                $cfield[] = ( $is_email )?apply_filters('mcm_munge',$val,$val,$custom ):$val; 
     216                            } 
     217                            $p[$key] =  explode( ", ", $cfield ); 
    209218                        } else { 
    210                             $p[$key] = $value[0]; 
     219                            $p[$key] =  ( $is_email )?apply_filters('mcm_munge',$value[0],$value[0], $custom ):$value[0]; 
    211220                        } 
    212221                    } 
    213222                } 
    214             if ( isset($p['_email']) ) { $p['_email'] = apply_filters('mcm_munge',$p['_email'], $p['_email'], $custom ); } 
    215223            $p = apply_filters('mcm_extend_posts', $p, $p, $custom ); 
    216224            $this_post = mcm_run_template( $p, $display, $column, $wrapper ); 
     
    222230        } 
    223231    } 
    224     if ( $elem != '' ) { $front = "<$elem class='list-wrapper'>"; $back = "</$elem>"; } else { $elem = $unelem = '';} 
     232    if ( $elem != '' ) { $front = "<$elem class='list-wrapper'>"; $back = "</$elem>"; } else { $elem = $unelem = $front = $back = '';} 
    225233     
    226234    if ( $display != 'custom' ) { 
     
    459467    "\n". 
    460468        "//-"."->\n" . 
    461         "<" . "/script><noscript>N/A" . 
    462     "<"."/noscript>"; 
     469        "<" . "/script>"; 
    463470    return $txt; 
    464471} 
  • my-content-management/trunk/mcm-widgets.php

    r607690 r657057  
    8484        global $mcm_enabled; 
    8585        $enabled = $mcm_enabled; 
    86         $post_type = esc_attr($instance['mcm_posts_widget_post_type']); 
    87         $display = esc_attr($instance['display']); 
    88         $count = (int) $instance['count']; 
    89         $direction = esc_attr($instance['direction']);       
    90         $order = esc_attr($instance['order']); 
    91         $title = esc_attr($instance['title']); 
    92         $term = ( isset($instance['term']) )?esc_attr($instance['term']):'';         
     86        $post_type = isset( $instance['mcm_posts_widget_post_type'] ) ? esc_attr($instance['mcm_posts_widget_post_type']) : ''; 
     87        $display = isset( $instance['display'] ) ? esc_attr($instance['display']) : ''; 
     88        $count = isset( $instance['count'] ) ? (int) $instance['count'] : -1; 
     89        $direction = isset( $instance['direction'] ) ? esc_attr($instance['direction']) : ''; 
     90        $order = isset( $instance['order'] )? esc_attr($instance['order']) : ''; 
     91        $title = isset( $instance['title'] ) ? esc_attr($instance['title']) : ''; 
     92        $term = isset($instance['term']) ? esc_attr($instance['term']) : '';         
    9393    ?> 
    9494        <p> 
  • my-content-management/trunk/my-content-management.php

    r618073 r657057  
    66Author: Joseph C Dolson 
    77Author URI: http://www.joedolson.com 
    8 Version: 1.2.8 
     8Version: 1.3.0 
    99*/ 
    1010/*  Copyright 2011-2012  Joe Dolson (email : joe@joedolson.com) 
     
    2424    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    2525*/ 
    26 $mcm_version = '1.2.8'; 
     26$mcm_version = '1.3.0'; 
    2727// Enable internationalisation 
    2828load_plugin_textdomain( 'my-content-management',false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );  
     
    120120// filter to auto replace content with full template 
    121121add_filter( 'the_content','mcm_replace_content', 10, 2 ); 
    122 function mcm_replace_content( $content ) { 
     122function mcm_replace_content( $content, $id=false ) { 
    123123    global $template; 
     124    if ( !is_main_query() && !$id ) { return $content; } 
    124125    $post_type = get_post_type(); 
    125126    $mcm_options = get_option('mcm_options'); 
     
    141142    return mcm_search_form( $type ); 
    142143} 
     144 
     145function mcm_munger($atts) { 
     146    extract(shortcode_atts(array( 
     147                'address' => '' 
     148            ), $atts)); 
     149    return mcm_munge( $address ); 
     150} 
    143151// Shortcodes  
    144152add_shortcode('my_content','mcm_show_posts'); 
    145153add_shortcode('custom_search','mcm_search_custom'); 
    146154add_shortcode('my_archive','mcm_show_archive');  
     155add_shortcode('email','mcm_munger'); 
    147156// Filters 
    148157//add_filter('the_content', 'mcm_pre_process_shortcode', 7); 
     
    198207function mcm_upgrade_plugin() { 
    199208//  no upgrade routine for 1.2.0 
     209//  no upgrade routine for 1.3.0 
    200210    global $mcm_version,$default_mcm_types, $default_mcm_fields, $default_mcm_extras;; 
    201211    $from = get_option('mcm_version'); 
     
    240250    $wp_version = get_bloginfo('version'); 
    241251    $home_url = home_url(); 
    242     $wp_url = get_bloginfo('wpurl'); 
     252    $wp_url = site_url(); 
    243253    $language = get_bloginfo('language'); 
    244254    $charset = get_bloginfo('charset'); 
     
    363373// Function to add javascript to the admin header 
    364374function mcm_add_scripts() { 
    365     wp_enqueue_script('common'); 
    366     wp_enqueue_script('wp-lists'); 
    367     wp_enqueue_script('postbox'); 
     375    wp_register_script( 'addfields', plugins_url( 'js/jquery.addfields.js', __FILE__ ), array( 'jquery' ) ); 
     376    wp_enqueue_script( 'addfields' ); 
    368377} 
    369378 
     
    373382$enabled = (isset($_POST['mcm_enabler']))?$_POST['mcm_posttypes']:$enabled; 
    374383?> 
    375 <div class="wrap"> 
    376 <div id="icon-index" class="icon32"><br /></div> 
    377 <h2><?php _e('My Content Management','my-content-management'); ?></h2> 
    378 <div class="mcm-template-guide"> 
    379 <h3><?php _e('Basic Template Tags','my-content-management'); ?></h3> 
    380 <dl> 
    381 <dt><code>{id}</code></dt> 
    382 <dd><?php _e('Post ID','my-content-management'); ?></dd> 
    383  
    384 <dt><code>{excerpt}</code></dt> 
    385 <dd><?php _e('Post excerpt (with auto paragraphs)','my-content-management'); ?></dd> 
    386  
    387 <dt><code>{excerpt_raw}</code></dt> 
    388 <dd><?php _e('Post excerpt (unmodified)','my-content-management'); ?></dd> 
    389  
    390 <dt><code>{content}</code></dt> 
    391 <dd><?php _e('Post content (with auto paragraphs and shortcodes processed)','my-content-management'); ?></dd> 
    392  
    393 <dt><code>{content_raw}</code></dt> 
    394 <dd><?php _e('Post content (unmodified)','my-content-management'); ?></dd> 
    395  
    396 <dt><code>{thumbnail}</code></dt> 
    397 <dd><?php _e('Featured image as thumbnail.','my-content-management'); ?></dd> 
    398  
    399 <dt><code>{medium}</code></dt> 
    400 <dd><?php _e('Featured image at medium size.','my-content-management'); ?></dd> 
    401  
    402 <dt><code>{large}</code></dt> 
    403 <dd><?php _e('Featured image at large size.','my-content-management'); ?></dd> 
    404  
    405 <dt><code>{full}</code></dt> 
    406 <dd><?php _e('Featured image at original size.','my-content-management'); ?></dd> 
    407  
    408 <dt><code>{permalink}</code></dt> 
    409 <dd><?php _e('Permalink URL for post','my-content-management'); ?></dd> 
    410  
    411 <dt><code>{link_title}</code></dt> 
    412 <dd><?php _e('Post title linked to permalink URL','my-content-management'); ?></dd> 
    413  
    414 <dt><code>{title}</code></dt> 
    415 <dd><?php _e('Post title','my-content-management'); ?></dd> 
    416  
    417 <dt><code>{shortlink}</code></dt> 
    418 <dd><?php _e('Post shortlink','my-content-management'); ?></dd> 
    419  
    420 <dt><code>{modified}</code></dt> 
    421 <dd><?php _e('Post last modified date','my-content-management'); ?></dd> 
    422  
    423 <dt><code>{date}</code></dt> 
    424 <dd><?php _e('Post publication date','my-content-management'); ?></dd> 
    425  
    426 <dt><code>{author}</code></dt> 
    427 <dd><?php _e('Post author display name','my-content-management'); ?></dd> 
    428  
    429 <dt><code>{terms}</code></dt> 
    430 <dd><?php _e('List of taxonomy terms associated with post.','my-content-management'); ?></dd> 
    431  
    432 </dl> 
    433 <p> 
    434 <?php _e('Any custom field can also be referenced via shortcode, using the same pattern with the name of the custom field: <code>{custom_field_name}</code>','my-content-management'); ?> 
    435 </p> 
    436 </div> 
    437  
    438     <div class="mcm-settings meta-box-sortables" id="poststuff"> 
    439         <div class="postbox" id="mcm-settings"> 
     384    <div class='wrap mcm-settings'> 
     385    <div id="icon-index" class="icon32"><br /></div> 
     386    <h2><?php _e('My Content Management','my-content-management'); ?></h2> 
     387    <div class="postbox-container" style="width: 70%"> 
     388     
     389        <div class="metabox-holder"> 
     390        <div class="mcm-settings ui-sortable meta-box-sortables">    
     391        <div class="postbox"> 
    440392        <h3><?php _e('Enable Custom Post Types','my-content-management'); ?></h3> 
    441393            <div class="inside"> 
    442             <?php mcm_show_support_box(); ?>         
    443394            <?php mcm_updater(); ?> 
    444395            <form method='post' action='<?php echo admin_url('options-general.php?page=my-content-management/my-content-management.php'); ?>'> 
     
    456407        <?php mcm_template_setter(); ?> 
    457408        <?php } ?> 
    458  
     409        </div> 
     410        </div> 
     411 
     412        <div class="metabox-holder"> 
     413        <div class="mcm-settings ui-sortable meta-box-sortables">    
    459414        <div class="postbox" id="get-support"> 
    460415        <h3><?php _e('Get Plug-in Support','my-content-management'); ?></h3> 
     
    462417            <?php mcm_get_support_form(); ?> 
    463418            </div> 
     419        </div> 
     420        </div> 
     421        </div> 
     422    </div> 
     423    <div class="postbox-container" style="width: 20%"> 
     424        <div class="metabox-holder"> 
     425        <div class="mcm-settings ui-sortable meta-box-sortables">    
     426        <div class="mcm-template-guide postbox" id="get-support"> 
     427        <h3><?php _e('Support My Content Management','my-content-management'); ?></h3> 
     428            <div class="inside"> 
     429                <?php mcm_show_support_box(); ?>         
     430            </div> 
     431        </div> 
     432        </div> 
     433        </div>   
     434        <div class="metabox-holder"> 
     435        <div class="mcm-settings ui-sortable meta-box-sortables">    
     436        <div class="mcm-template-guide postbox" id="get-support"> 
     437        <h3><?php _e('Basic Template Tags','my-content-management'); ?></h3> 
     438            <div class="inside"> 
     439            <dl> 
     440            <dt><code>{id}</code></dt> 
     441            <dd><?php _e('Post ID','my-content-management'); ?></dd> 
     442 
     443            <dt><code>{excerpt}</code></dt> 
     444            <dd><?php _e('Post excerpt (with auto paragraphs)','my-content-management'); ?></dd> 
     445 
     446            <dt><code>{excerpt_raw}</code></dt> 
     447            <dd><?php _e('Post excerpt (unmodified)','my-content-management'); ?></dd> 
     448 
     449            <dt><code>{content}</code></dt> 
     450            <dd><?php _e('Post content (with auto paragraphs and shortcodes processed)','my-content-management'); ?></dd> 
     451 
     452            <dt><code>{content_raw}</code></dt> 
     453            <dd><?php _e('Post content (unmodified)','my-content-management'); ?></dd> 
     454 
     455            <dt><code>{thumbnail}</code></dt> 
     456            <dd><?php _e('Featured image as thumbnail.','my-content-management'); ?></dd> 
     457 
     458            <dt><code>{medium}</code></dt> 
     459            <dd><?php _e('Featured image at medium size.','my-content-management'); ?></dd> 
     460 
     461            <dt><code>{large}</code></dt> 
     462            <dd><?php _e('Featured image at large size.','my-content-management'); ?></dd> 
     463 
     464            <dt><code>{full}</code></dt> 
     465            <dd><?php _e('Featured image at original size.','my-content-management'); ?></dd> 
     466 
     467            <dt><code>{permalink}</code></dt> 
     468            <dd><?php _e('Permalink URL for post','my-content-management'); ?></dd> 
     469 
     470            <dt><code>{link_title}</code></dt> 
     471            <dd><?php _e('Post title linked to permalink URL','my-content-management'); ?></dd> 
     472 
     473            <dt><code>{title}</code></dt> 
     474            <dd><?php _e('Post title','my-content-management'); ?></dd> 
     475 
     476            <dt><code>{shortlink}</code></dt> 
     477            <dd><?php _e('Post shortlink','my-content-management'); ?></dd> 
     478 
     479            <dt><code>{modified}</code></dt> 
     480            <dd><?php _e('Post last modified date','my-content-management'); ?></dd> 
     481 
     482            <dt><code>{date}</code></dt> 
     483            <dd><?php _e('Post publication date','my-content-management'); ?></dd> 
     484 
     485            <dt><code>{author}</code></dt> 
     486            <dd><?php _e('Post author display name','my-content-management'); ?></dd> 
     487 
     488            <dt><code>{terms}</code></dt> 
     489            <dd><?php _e('List of taxonomy terms associated with post.','my-content-management'); ?></dd> 
     490 
     491            <dt><code>{edit_link}</code></dt> 
     492            <dd><?php _e('When logged in, display link to edit the current post.','my-content-management'); ?></dd> 
     493 
     494            </dl> 
     495            <p> 
     496            <?php _e('Any custom field can also be referenced via shortcode, using the same pattern with the name of the custom field: <code>{custom_field_name}</code>','my-content-management'); ?> 
     497            </p> 
     498            </div> 
     499        </div> 
     500        </div> 
    464501        </div> 
    465502    </div> 
     
    489526                    if ( in_array( $key, $enabled ) ) { $checked = ' checked="checked"'; } else { $checked = ''; } 
    490527                } 
    491                 $return .= "<li><input type='checkbox' value='$key' name='mcm_posttypes[]' id='mcm_$key'$checked /> <label for='mcm_$key'>$value[3] <small><a href='".admin_url("options-general.php?page=my-content-management/my-content-management.php&mcm_edit=$key")."'>".__('Edit','my-content-management')." '$value[3]'</a> &bull; <a href='".admin_url("options-general.php?page=my-content-management/my-content-management.php&mcm_delete=$key")."'>".__('Delete','my-content-management')."  '$value[3]'</a></small></label></li>\n"; 
     528                $return .= "<li><input type='checkbox' value='$key' name='mcm_posttypes[]' id='mcm_$key'$checked /> <label for='mcm_$key'>$value[3] (<code>$key</code>) <small><a href='".admin_url("options-general.php?page=my-content-management/my-content-management.php&mcm_edit=$key")."'>".__('Edit','my-content-management')." '$value[3]'</a> &bull; <a href='".admin_url("options-general.php?page=my-content-management/my-content-management.php&mcm_delete=$key")."'>".__('Delete','my-content-management')."  '$value[3]'</a></small></label></li>\n"; 
    492529            } 
    493530        } 
     
    701738                <p>".__('The glossary extension to My Content Management is enabled.','my-content-management')."</p> 
    702739                <ul> 
    703                 <li><code>[alphabet]</code>: ".__('displays list of linked first characters represented in your Glossary. (Roman alphabet only.)','my-content-management')."</li> 
     740                <li><code>[alphabet numbers='true']</code>: ".__('displays list of linked first characters represented in your Glossary. (Roman alphabet only, including numbers 0-9 by default.)','my-content-management')."</li> 
    704741                <li><code>[term id='' term='']</code>: ".__('displays value of term attribute linked to glossary term with ID attribute.','my-content-management')."</li> 
    705742                <li><strong>".__('Feature','my-content-management').":</strong> ".__('Adds links throughout content for each term in your glossary.','my-content-management')."</li> 
     
    785822    <div id="support"> 
    786823        <div class="buy"> 
    787         <a href="http://www.joedolson.com/articles/my-content-management/guide/" rel="external"><?php _e("Buy the User's Guide",'my-content-management'); ?></a> 
     824        <a href="http://www.joedolson.com/articles/my-content-management/guide/" rel="external"><?php _e("Need Help? <strong>Buy the User's Guide</strong>",'my-content-management'); ?></a> 
    788825        </div> 
    789826        <div class="resources"> 
     827        <p> 
     828        <a href="https://twitter.com/intent/tweet?screen_name=joedolson&text=My%20Content%20Management%20is%20awesome!" class="twitter-mention-button" data-size="large" data-related="joedolson">Tweet to @joedolson</a> 
     829        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> 
     830        </p>         
    790831        <ul> 
    791         <li><strong><a href="#get-support" rel="external"><?php _e("Get Support",'my-content-management'); ?></a></strong></li> 
    792         <li><a href="http://www.joedolson.com/articles/bugs/"><?php _e("Report a bug",'my-content-management'); ?></a></li>  
     832        <li><strong><a href="#get-support" rel="external"><?php _e("Get Support",'my-content-management'); ?></a></strong> &bull; <a href="http://www.joedolson.com/articles/bugs/"><?php _e("Report a bug",'my-content-management'); ?></a></li>    
    793833            <li><form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
    794834            <div> 
     
    809849} 
    810850 
     851add_action( 'admin_menu','mcm_add_fields_pages'); 
     852 
     853function mcm_add_fields_pages() { 
     854    if ( function_exists( 'add_submenu_page' ) ) { 
     855        $post_types = get_post_types('','object'); 
     856        $submenu_page = add_submenu_page( "edit.php", "Posts > My Content Management > Custom Fields", "Custom Fields", 'manage_options', "post_fields", 'mcm_assign_custom_fields' ); 
     857        add_action( 'admin_head-'. $submenu_page, 'mcm_styles' );        
     858        foreach ( $post_types as $type ) { 
     859            $name = $type->name; 
     860            $label = $type->labels->name; 
     861            $submenu_page = add_submenu_page( "edit.php?post_type=$name", "$label > My Content Management > Custom Fields", "Custom Fields", 'manage_options', $name."_fields", 'mcm_assign_custom_fields' ); 
     862            add_action( 'admin_head-'. $submenu_page, 'mcm_styles' ); 
     863        } 
     864    } 
     865} 
     866 
     867add_action( 'admin_head', 'mcm_admin_style' ); 
     868function mcm_admin_style() { 
     869?> 
     870<style type='text/css'> 
     871#normal-sortables .mcm_field { float: left; width:50%; } 
     872</style> 
     873<?php 
     874} 
     875 
     876function mcm_assign_custom_fields() { 
     877?> 
     878<div class="wrap"> 
     879<div id="icon-index" class="icon32"><br /></div> 
     880<h2><?php _e('My Content Management &raquo; Manage Custom Fields','my-content-management'); ?></h2> 
     881    <div class="postbox-container" style="width: 70%"> 
     882        <div class="metabox-holder"> 
     883        <div class="mcm-settings ui-sortable meta-box-sortables">    
     884        <div class="postbox" id="mcm-settings"> 
     885        <h3><?php _e('Custom Fields Assigned to this post type','my-content-management'); ?></h3> 
     886            <div class="inside"> 
     887            <p><?php _e('Select the sets of custom fields enabled for this post type','my-content-management'); ?></p> 
     888            <?php $current_post_type = $_GET['page']; $page = ( isset($_GET['post_type']) )?$_GET['post_type']:'post'; ?> 
     889            <form method='post' action='<?php echo esc_url( admin_url("edit.php?post_type=$page&page=$current_post_type") ); ?>'> 
     890                <div><input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('my-content-management-nonce'); ?>' /></div> 
     891                <div> 
     892                <?php mcm_fields( 'assign', $page ); ?> 
     893                <p> 
     894                    <input type='submit' value='<?php _e('Update Assignments','my-content-manager'); ?>' name='mcm_custom_fields' class='button-primary' /> <a href="<?php echo admin_url("options-general.php?page=mcm_custom_fields&mcm_fields_add=new"); ?>"><?php _e('Add new custom field set','my-content-manager'); ?></a> 
     895                </p> 
     896                </div> 
     897            </form> 
     898            </div>           
     899        </div> 
     900        </div> 
     901        </div> 
     902    </div> 
     903    <div class="postbox-container" style="width: 20%"> 
     904        <div class="metabox-holder"> 
     905        <div class="mcm-settings ui-sortable meta-box-sortables">    
     906        <div class="postbox" id="mcm-settings"> 
     907        <h3><?php _e('Support My Content Management','my-content-management'); ?></h3> 
     908            <div class="inside">     
     909                <?php mcm_show_support_box(); ?> 
     910            </div> 
     911        </div> 
     912        </div> 
     913        </div> 
     914    </div> 
     915     
     916</div> 
     917    <?php 
     918} 
     919 
     920function mcm_add_custom_field_support( $fieldset, $page ) { 
     921    $option = get_option('mcm_options'); 
     922    $array = $option['extras'][$fieldset][0]; 
     923    if ( is_string($array) ) { $array = array( $array ); } 
     924    if ( !in_array( $page, $array ) ) { array_push( $array, $page ); } 
     925    $option['extras'][$fieldset][0] = $array; 
     926    update_option( 'mcm_options', $option ); 
     927} 
     928 
     929function mcm_delete_custom_field_support( $fieldset, $page ) { 
     930    $option = get_option('mcm_options'); 
     931    $array = $option['extras'][$fieldset][0]; 
     932    if ( is_string($array) ) { $array = array(); } 
     933    if ( in_array( $page, $array ) ) { $key = array_search( $page, $array ); unset( $array[$key] ); } 
     934    $option['extras'][$fieldset][0] = $array; 
     935    update_option( 'mcm_options', $option ); 
     936} 
     937 
     938function mcm_fields( $show='assign',$post_type=false ) { 
     939    if ( isset($_POST['mcm_custom_fields']) ) { 
     940        $nonce=$_REQUEST['_wpnonce']; 
     941        if (! wp_verify_nonce($nonce,'my-content-management-nonce') ) die("Security check failed");      
     942        $extras = $_POST['mcm_field_extras']; 
     943        $page = $post_type; 
     944        foreach ( $extras as $key => $value ) { 
     945            if ( $value == 'on' ) { 
     946                mcm_add_custom_field_support( $key, $page ); 
     947            } else { 
     948                mcm_delete_custom_field_support( $key, $page ); 
     949            } 
     950        }        
     951        echo "<div class='updated fade'><p>".__('Custom fields for this post type updated','my-content-management')."</p></div>"; 
     952    } 
     953    $option = get_option('mcm_options'); 
     954    $extras = $option['extras']; 
     955    $checked = ''; 
     956    $return = ''; 
     957    if ( is_array($extras) ) { 
     958        foreach ( $extras as $key=>$value ) { 
     959            $page = $post_type; 
     960            $checked_off = ' checked="checked"'; 
     961            if ( is_string( $value[0] ) ) { 
     962                $checked_on = ( $value[0] == $page )?' checked="checked"':''; 
     963            } else if ( in_array( $page, $value[0] ) ) { 
     964                $checked_on = ( in_array( $page, $value[0] ) )?' checked="checked"':''; 
     965            } else { 
     966                $checked_off = ' checked="checked"'; 
     967                $checked_on = '';  
     968            } 
     969            $k = urlencode($key); 
     970            if ( $show == 'assign' ) { 
     971                $return .= "<li><fieldset><legend>$key</legend> 
     972                <input type='radio' value='off' name='mcm_field_extras[$key]' id='mcm_off_$page'$checked_off /> <label for='mcm_off_$page'>".__('Off','my-content-management')."</label>  
     973                <input type='radio' value='on' name='mcm_field_extras[$key]' id='mcm_off_$page'$checked_on /> <label for='mcm_off_$page'>".__('On','my-content-management')." <small><a href='".admin_url("options-general.php?page=mcm_custom_fields&mcm_fields_edit=$k")."'>".__('Edit','my-content-management')."</a></small></label> 
     974                </fieldset></li>\n"; 
     975            } else { 
     976                $return .= "<li><a href='".admin_url("options-general.php?page=mcm_custom_fields&mcm_fields_edit=$k")."'>".__('Edit','my-content-management')." $key</a></li>"; 
     977            } 
     978        } 
     979    } 
     980    echo "<ul class='mcm_customfields'>".$return."</ul>"; 
     981} 
     982 
     983function mcm_fields_updater() { 
     984    // This is what I do to edit custom field sets or add new sets. 
     985    if ( !isset( $_GET['mcm_fields_edit'] ) ) { 
     986        mcm_get_fieldset(); 
     987    } 
     988    if ( isset($_POST['mcm_custom_field_sets']) ) { 
     989        $message = mcm_update_custom_fieldset( $_POST ); 
     990    }    
     991    if ( isset( $_GET['mcm_fields_edit'] ) ) { 
     992        mcm_get_fieldset( $_GET['mcm_fields_edit'] ); 
     993    } 
     994} 
     995 
     996function mcm_get_fieldset( $fieldset=false ) { 
     997    $option = get_option( 'mcm_options' ); 
     998    if ( !$fieldset ) { 
     999        $posts = get_post_types(array( 'public'=>'true' ) ,'object'); 
     1000        $post_types = ''; 
     1001        foreach ( $posts as $value ) { 
     1002            $name = $value->name; 
     1003            $label = $value->labels->name; 
     1004            $post_types .= "<option value='$name'>$label</option>\n"; 
     1005        } 
     1006        $fieldset_title = "<p><label for='mcm_new_fieldset'><strong>".__('New Fieldset Title','my-content-management')."</strong></label> <input type='text' id='mcm_new_fieldset' name='mcm_new_fieldset' /></p><p><label for='mcm_assign_to'><strong>".__('Attach to','my-content-management')."</strong></label><br /><select name='mcm_assign_to' id='mcm_assign_to' multiple='multiple'>$post_types</select></p>"; 
     1007    } else { 
     1008        $fieldset_title = ''; 
     1009    } 
     1010     
     1011    $form = $fieldset_title.'<table class="widefat"><thead><tr><th scope="col">'.__('Field Label','my-content-management').'</th><th scope="col">'.__('Input Type','my-content-management').'</th><th scope="col">Description/Options</th><th  scope="col">'.__('Delete','my-content-management').'</th></tr></thead><tbody>'; 
     1012    $odd = 'odd';  
     1013    if ( isset( $option['fields'][$fieldset] ) ) { 
     1014        $fields = ( $fieldset )?$option['fields'][urldecode($fieldset)]:''; 
     1015    } 
     1016        $field_types = array( 
     1017            'text'=>__('Single line of text','my-content-management'), 
     1018            'textarea'=>__('Multiple lines of text','my-content-management'), 
     1019            'select'=>__('Select dropdown','my-content-management'), 
     1020            'color'=>__('Color input / HTML5','my-content-management'), 
     1021            'date'=>__('Date input / HTML5','my-content-management'), 
     1022            'tel'=>__('Telephone / HTML5','my-content-management'), 
     1023            'time'=>__('Time / HTML5','my-content-management'), 
     1024            'url'=>__('URL / HTML5','my-content-management'), 
     1025            'email'=>__('Email / HTML5','my-content-management') 
     1026            );   
     1027    if ( $fieldset && isset( $option['fields'][$fieldset] ) ) { 
     1028        foreach ( $fields as $key=>$value ) { 
     1029            if ( is_array( $value[2] ) ) { 
     1030                $choices = esc_attr( stripslashes( implode( ', ', $value[2] ) ) ); 
     1031            } else { 
     1032                $choices = esc_attr(stripslashes($value[2])); 
     1033            } 
     1034            $field_type_select = ''; 
     1035            foreach ( $field_types as $k => $v ) { 
     1036                $selected = ( $value[3] == $k  || ( $k == 'text' && $value[3] == 'mcm_text_field' ) )?' selected="selected"':''; 
     1037                $field_type_select .= "<option value='$k'$selected>$v</option>\n"; 
     1038            } 
     1039            if ( $value[3] == 'select' ) { $labeled = __("Options",'my-content-management'); } else { $labeled = __("Additional Text",'my-content-management'); } 
     1040        $form .= " 
     1041        <tr class='mcm_custom_fields_form $odd'> 
     1042            <td> 
     1043                <input type='hidden' name='mcm_field_key[$key]'  value='$value[0]' /> 
     1044                <label for='mcm_field_label$key'>".__('Label','my-content-management')."</label> <input type='text' name='mcm_field_label[$key]' id='mcm_field_label$key' value='".esc_attr(stripslashes($value[1]))."' /> 
     1045            </td> 
     1046            <td> 
     1047                <label for='mcm_field_type$key'>".__('Type','my-content-management')."</label>  
     1048                    <select name='mcm_field_type[$key]' id='mcm_field_type$key'> 
     1049                    $field_type_select 
     1050                    </select> 
     1051            </td> 
     1052            <td> 
     1053                <label for='mcm_field_options$key'>$labeled</label> <input type='text' name='mcm_field_options[$key]' id='mcm_field_options$key' value='$choices' /> 
     1054            </td> 
     1055            <td> 
     1056                <label for='mcm_field_delete$key'>".__('Delete','my-content-management')."</label> <input type='checkbox' name='mcm_field_delete[$key]' id='mcm_field_delete$key' value='delete' /> 
     1057            </td> 
     1058        </tr>"; 
     1059        $odd = ( $odd == 'odd' ) ? 'even' : 'odd'; 
     1060        } 
     1061    } else if ( $fieldset && !isset( $option['fields'][$fieldset] ) ) { 
     1062        echo "<div class='updated error'><p>".__('There is no field set by that name','my-content-management')."</p></div>"; 
     1063    } 
     1064        $field_type_select = ''; 
     1065        foreach ( $field_types as $k => $v ) { 
     1066            $field_type_select .= "<option value='$k'>$v</option>"; 
     1067        }    
     1068    $form .= " 
     1069    <tr class='mcm_custom_fields_form clonedInput' id='field1'> 
     1070        <td> 
     1071            <input type='hidden' name='mcm_field_key[]'  value='' /> 
     1072            <label for='mcm_field_label'>".__('Label','my-content-management')."</label> <input type='text' name='mcm_field_label[]' id='mcm_field_label' value='' /> 
     1073        </td> 
     1074        <td> 
     1075            <label for='mcm_field_type'>".__('Type','my-content-management')."</label>  
     1076                <select name='mcm_field_type[]' id='mcm_field_type'> 
     1077                $field_type_select 
     1078                </select> 
     1079        </td> 
     1080        <td> 
     1081            <label for='mcm_field_options'>".__('Options/Additional Text','my-content-management')."</label> <input type='text' name='mcm_field_options[]' id='mcm_field_options' value='' /> 
     1082        </td> 
     1083        <td> 
     1084        </td> 
     1085    </tr>";  
     1086    $form .= '</tbody></table>'; 
     1087        $add_field =__('Add another field','my-content-management'); 
     1088        $del_field = __('Remove last field','my-content-management'); 
     1089    $form .=  ' 
     1090            <p> 
     1091                <input type="button" class="add_field" value="'.$add_field.'" class="button" /> 
     1092                <input type="button" class="del_field" value="'.$del_field.'" class="button" /> 
     1093            </p>'; 
     1094 
     1095    echo $form; 
     1096} 
     1097 
     1098function mcm_update_custom_fieldset( $post ) { 
     1099    $option = get_option('mcm_options'); 
     1100    $array = array(); 
     1101    if ( !isset($post['mcm_field_delete']) ) { $post['mcm_field_delete'] = array(); } 
     1102    $delete = @array_keys( $post['mcm_field_delete'] ); 
     1103    $keys = $post['mcm_field_key']; 
     1104    $labels = $post['mcm_field_label']; 
     1105    $types = $post['mcm_field_type']; 
     1106    $options = $post['mcm_field_options']; 
     1107    $count = count( $labels ); 
     1108    $delete_count = count( $delete ); 
     1109        for ( $i=0;$i<$count;$i++ ) { 
     1110            if ( in_array( $i, $delete ) ) { } else { 
     1111                if ( $keys[$i] != '' ) { 
     1112                if ( $types[$i] == 'select' ) { $opt = explode( ',', $options[$i] ); } else { $opt = $options[$i]; } 
     1113                $array[$i] = array(  
     1114                    $keys[$i],  
     1115                    $labels[$i],  
     1116                    $opt,  
     1117                    $types[$i]  
     1118                ); 
     1119                } else if ( $labels[$i] != '' ) { 
     1120                if ( $types[$i] == 'select' ) { $opt = explode( ',', $options[$i] ); } else { $opt = $options[$i]; }         
     1121                $k = '_'.sanitize_title($labels[$i]); 
     1122                $array[$i] = array(  
     1123                    $k,  
     1124                    $labels[$i],  
     1125                    $opt,  
     1126                    $types[$i]  
     1127                );   
     1128                } else { 
     1129                    continue; 
     1130                } 
     1131            } 
     1132        } 
     1133    $fieldset = ( isset($_GET['mcm_fields_edit']) )?$_GET['mcm_fields_edit']:false; 
     1134    if ( isset( $post['mcm_new_fieldset'] ) ) { $fieldset = $post['mcm_new_fieldset']; $added = __('added','my-content-management'); } else { $added = __('updated','my-content-management'); } 
     1135    if ( !empty( $option['extras'][$fieldset] ) && isset( $post['mcm_new_fieldset'] ) ) { $fieldset = $fieldset.' (2)'; } 
     1136    if ( !$fieldset ) { return __("No custom field set was defined.",'my-content-management'); } else { $fieldset = urldecode( $fieldset ); } 
     1137    if ( isset( $post['mcm_new_fieldset'] ) ) { $mcm_assign_to = $post['mcm_assign_to']; $option['extras'][$fieldset] = array( $mcm_assign_to, 'side' ); } 
     1138    $option['fields'][$fieldset] = $array; 
     1139    if ( $count == $delete_count || $delete_count > $count || ( $count == 1 && !isset( $post['mcm_new_fieldset'] ) ) ) { unset( $option['fields'][$fieldset] ); unset( $option['extras'][$fieldset] ); } // if all fields are deleted, remove set. 
     1140    update_option('mcm_options',$option); 
     1141    return sprintf( __('You have %1$s the %2$s group of custom fields.', 'my-content-management' ), $added, $fieldset ); 
     1142} 
     1143 
    8111144// Add the administrative settings to the "Settings" menu. 
    8121145function mcm_add_support_page() { 
     
    8141147         $plugin_page = add_options_page( 'My Content Management', 'My Content Management', 'manage_options', __FILE__, 'mcm_settings_page' ); 
    8151148         add_action( 'admin_head-'. $plugin_page, 'mcm_styles' ); 
    816     } 
    817     add_action('admin_print_styles-'. $plugin_page, 'mcm_add_scripts'); 
    818  } 
     1149         add_action('admin_print_styles-'. $plugin_page, 'mcm_add_scripts'); 
     1150         $plugin_page = add_options_page( 'My Custom Fields', 'My Custom Fields', 'manage_options', 'mcm_custom_fields', 'mcm_configure_custom_fields' );     
     1151         add_action( 'admin_head-'. $plugin_page, 'mcm_styles' ); 
     1152         add_action('admin_print_styles-'. $plugin_page, 'mcm_add_scripts'); 
     1153          
     1154    } 
     1155} 
     1156 
     1157 
     1158function mcm_configure_custom_fields() { 
     1159?> 
     1160<div class="wrap"> 
     1161<div id="icon-index" class="icon32"><br /></div> 
     1162<h2><?php _e('My Content Management &raquo; Manage Custom Fields','my-content-management'); ?></h2> 
     1163 
     1164    <div class="postbox-container" style="width: 70%"> 
     1165        <div class="metabox-holder"> 
     1166        <div class="mcm-settings ui-sortable meta-box-sortables">    
     1167        <div class="postbox" id="mcm-settings"> 
     1168        <h3><?php _e('Manage Custom Fieldsets','my-content-management'); ?></h3> 
     1169            <div class="inside"> 
     1170<?php 
     1171    if ( isset($_POST['mcm_custom_fieldsets']) ) { 
     1172        $message = mcm_update_custom_fieldset( $_POST ); 
     1173    } else { 
     1174        $message = false; 
     1175    } 
     1176    if ( $message ) { echo "<div class='updated notice'><p>$message</p></div>"; } 
     1177?>   
     1178            <?php mcm_fields( 'edit' ); ?> 
     1179            <p><?php _e('If the input type is a Select box, enter the selectable options as a comma-separated list in the Description/Options field.','my-content-management'); ?></p> 
     1180            <?php if ( isset($_GET['mcm_fields_edit'] ) ) { $append = "&mcm_fields_edit=".urlencode($_GET['mcm_fields_edit']); } else { $append = ''; } ?> 
     1181            <form method='post' action='<?php echo esc_url( admin_url("options-general.php?page=mcm_custom_fields$append") ); ?>'> 
     1182                <div><input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('my-content-management-nonce'); ?>' /></div> 
     1183                <div> 
     1184                <?php mcm_fields_updater(); ?> 
     1185                <p> 
     1186                    <input type='submit' value='<?php _e('Update Custom Fieldsets','my-content-manager'); ?>' name='mcm_custom_fieldsets' class='button-primary' /> <a href="<?php echo admin_url("options-general.php?page=mcm_custom_fields&mcm_fields_add=new"); ?>"><?php _e('Add new custom field set','my-content-manager'); ?></a> 
     1187                </p> 
     1188                </div> 
     1189            </form> 
     1190            <p><?php printf(__('HTML5 Input types have limited browser support. <a href="%s">Check whether your browser supports these fields</a>','my-content-management'),'http://miketaylr.com/code/input-type-attr.html'); ?></p>                    
     1191            </div>   
     1192        </div> 
     1193        </div> 
     1194        </div> 
     1195    </div> 
     1196     
     1197    <div class="postbox-container" style="width: 20%"> 
     1198        <div class="metabox-holder"> 
     1199        <div class="mcm-settings ui-sortable meta-box-sortables">    
     1200        <div class="mcm-template-guide postbox" id="get-support"> 
     1201        <h3><?php _e('Support My Content Management','my-content-management'); ?></h3> 
     1202            <div class="inside"> 
     1203                <?php mcm_show_support_box(); ?>         
     1204            </div> 
     1205        </div> 
     1206        </div> 
     1207        </div> 
     1208    </div> 
     1209</div> 
     1210    <?php 
     1211} 
     1212 
    8191213function mcm_styles() { 
    820     if ( $_GET['page'] == "my-content-management/my-content-management.php" ) { 
     1214    //if ( $_GET['page'] == "my-content-management/my-content-management.php" || $_GET['page'] == 'mcm_custom_fields' || ) { 
    8211215        echo '<link type="text/css" rel="stylesheet" href="'.plugins_url('mcm-styles.css', __FILE__ ).'" />'; 
    822 ?> 
    823 <script type="text/javascript"> 
    824     //<![CDATA[ 
    825     jQuery(document).ready( function($) { 
    826         // close postboxes that should be closed 
    827         $('.if-js-closed').removeClass('if-js-closed').addClass('closed'); 
    828         // postboxes setup 
    829         postboxes.add_postbox_toggles('wrap'); 
    830     }); 
    831     //]]> 
    832 </script> 
    833 <?php 
    834     } 
     1216    //} 
    8351217} 
    8361218add_action( 'admin_menu', 'mcm_add_support_page' ); 
  • my-content-management/trunk/my-glossary-filter.php

    r618073 r657057  
    22/* 
    33Plugin Name: My Content Management - Glossary Filter 
    4 Version: 1.2.8 
     4Version: 1.3.0 
    55Plugin URI: http://www.joedolson.com/articles/my-content-management/ 
    66Description: Adds custom glossary features: filters content for links to terms, etc. Companion plug-in to My Content Management. 
     
    2929} 
    3030 
    31 function mcm_glossary_alphabet() { 
     31function mcm_glossary_alphabet($atts) { 
     32    extract(shortcode_atts(array( 
     33        'numbers' => 'true', 
     34        ), $atts)); 
     35         
    3236    $return = ''; 
    33     $letters = explode( ',','0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z' ); 
    34         $words = get_option( 'mcm_glossary' ); 
    35         if ( !is_array( $words ) ) { 
    36             $words = mcm_set_glossary(); 
     37    $nums = range('0','9'); 
     38    $letters = range('a','z'); 
     39    if ($numbers != 'false') { 
     40        $letters = array_merge($nums, $letters); 
     41    } 
     42     
     43    $words = get_option( 'mcm_glossary' ); 
     44    if ( !is_array( $words ) ) { 
     45        $words = mcm_set_glossary(); 
     46    } 
     47 
     48    foreach ( $words as $key=>$value ) { 
     49        $this_letter = strtolower( substr( $key, 0, 1 ) ); 
     50        $live[]=$this_letter; 
     51    } 
     52    foreach ( $letters as $letter ) { 
     53        if ( in_array( $letter, $live ) ) { 
     54            $return .= "<li><a href='#glossary$letter'>$letter</a></li>"; 
     55        } else { 
     56            $return .= "<li class='inactive'>$letter</li>"; 
    3757        } 
    38         foreach ( $words as $key=>$value ) { 
    39             $this_letter = strtolower( substr( $key, 0, 1 ) ); 
    40             $live[]=$this_letter; 
    41         } 
    42         foreach ( $letters as $letter ) { 
    43             if ( in_array( $letter, $live ) ) { 
    44                 $return .= "<li><a href='#glossary$letter'>$letter</a></li>"; 
    45             } else { 
    46                 $return .= "<li class='inactive'>$letter</li>"; 
    47             } 
    48         } 
     58    } 
    4959    return "<ul class='glossary-alphabet' id='alpha'>".$return."</ul>"; 
    5060} 
  • my-content-management/trunk/readme.txt

    r618073 r657057  
    88Stable tag: trunk 
    99 
    10 Creates a set of common custom post types for advanced content management: FAQ, Testimonials, people (staff, contributors, etc.), and others! 
     10Creates common custom post types for advanced content management: FAQ, Testimonials, people (staff, contributors, etc.), and others! 
    1111  
    1212== Description == 
     
    1414My Content Management creates a suite of custom post types, each with an appropriate custom taxonomy and a set of commonly needed custom fields. The purpose of the plug-in is to provide a single common interface to create commonly needed extra content tools.  
    1515 
     16In addition to the default custom post types and custom field groups, you can create new custom post types, create new groups of custom fields, and edit the post types and custom field groups that are built in. 
     17 
     18There's a [User's Guide available for purchase](http://www.joedolson.com/articles/my-content-management/guide/) offering 25+ pages of detailed information on how to set up, use, and customize My Content Management. 
     19 
    1620Almost every web site I work on requires some kind of special content: testimonials, frequently asked questions, lists of staff -- you name it. There are plug-ins available for almost all of these - but they're all different. Different interfaces, different ways to display information, different default styling for how they're shown on the page.  
    1721 
     
    1923 
    2024There's no default styling outside of whatever your theme offers for the elements used. There is default HTML, but it can be 100% replaced through the included templating system, or by creating your own theme template documents to display these specific content types.  
    21  
    22 There's a [User's Guide available for purchase](http://www.joedolson.com/articles/my-content-management/guide/) offering 20 pages of detailed information on how to set up, use, and customize My Content Management. 
    2325 
    2426All content can be displayed using the shortcode [my_content type='custom_post_type']. Other supported attributes include: 
     
    5254The "id" attribute is not supported in the [my_archive] shortcode. (Because that would be silly.) The [my_archive] shortcode does support a "show_links" attribute which will turn on a navigation list to navigate to each displayed category. 
    5355 
     56Available languages (in order of completeness): 
     57Irish, Spanish 
     58 
     59Visit the [My Content Management translations site](http://translate.joedolson.com/projects/my-content-management/) to check how complete a translation is. 
     60 
    5461Translating my plug-ins is always appreciated. Visit <a href="http://translate.joedolson.com">my translations site</a> to start getting your language into shape! 
    5562 
    56 * Spanish (Tom Cloud) [1.1.2] 
     63Translator Credits (in no particular order)*: 
     64 
     65[Ale Gonzalez](http://60rpm.tv/i), [Outshine Solutions](http://outshinesolutions.com), [Jakob Smith](http://www.omkalfatring.dk/),, [globus2008](http://wordpress.org/support/profile/globus2008), Frederic Escallier, Luud Heck, Wim Strijbos, [Daisuke Abe](http://www.alter-ego.jp/), [Alex](http://blog.sotvoril.ru/), Mehmet Ko&ccedil;ali, Uwe Jonas, Florian Edelmann, Efva Nyberg, [Sabir Musta](http://mustaphasabir.altervista.org), Massimo Sgobino, Leonardo Kfoury, Alexandre Carvalho, Amir Khalilnejad, [Aurelio De Rosa](http://www.audero.it/), Bayram Dede, Dani Locasati, Dario Nunez, Dirk Ginader, Evren Erten, Fl&aacute;vio Pereira, Francois-Xavier Benard, [Gianni Diurno](http://www.gidibao.net), Giksi, Heinz Ochsner,  Kazuyuki Kumai, Liam Boogar, Maks, Mano, Massimo Sgobino, Mohsen Aghaei, Oscar, [Rashid Niamat](http://niamatmediagroup.nl/), Stefan Wikstrom, Thomas Meyer, Vedar Ozdemir, [Vikas Arora](http://www.wiznicworld.com), [Miriam de Paula](http://wpmidia.com.br), [HostUCan](http://www.hostucan.com), [Alex Alexandrov](http://www.webhostingrating.com), [Alyona Lompar](http://www.webhostinggeeks.com), [David Gil P&eacute;rez](http://www.sohelet.com), [Burkov Boris](http://chernobog.ru), [Raivo Ratsep](http://raivoratsep.com), [Jibo](http://jibo.ro), [Rasmus Himmelstrup](http://seoanalyst.dk), [kndb](http://blog.layer8.sh/) 
     66 
     67* Translators may not have contributed to this plug-in; but have contributed to my [translation repository](http://translate.joedolson.com). 
    5768 
    5869== Changelog == 
     70 
     71= 1.3.0 = 
     72 
     73* Added shortcode option to disable numbers in Glossary filters [Courtesy Bernhard Reiter] 
     74* Added edit post link template tag [Courtesy Bernhard Reiter] 
     75* Fixed a couple PHP notices 
     76* Major update: Added management for custom field groups (Create, Edit, Assign) 
     77* Languages: Added Irish translation. 
    5978 
    6079= 1.2.8 = 
     
    207226== Frequently Asked Questions == 
    208227 
    209 = Why don't you have any questions here? = 
    210  
    211 Hey. This was just launched. Got one to ask? 
     228= What's a custom post type? = 
     229 
     230All of the  major WordPress features are types of posts: Posts are the main one, but Pages are just a different type of post. This plug-in gives you a whole bunch of other types of posts, so you can handle discrete types of content in different ways - but using a common interface.  
    212231 
    213232= I don't really get how to use this plug-in. = 
    214233 
    215 Well, there really isn't one way to use this plug-in. There are many, many different ways to use it. I'd recommend buying the [User's Guide](http://www.joedolson.com/articles/my-content-management/guide/), which will walk you through many of the ways you can use this plug-in. Also, your purchase will help support me! Bonus! 
     234Well, there really isn't just one way to use this plug-in. There are many, many different ways to use it. I'd recommend buying the [User's Guide](http://www.joedolson.com/articles/my-content-management/guide/), which will walk you through many of the ways you can use this plug-in. Also, your purchase will help support me! Bonus! 
    216235 
    217236== Screenshots == 
     
    221240== Upgrade Notice == 
    222241 
    223  * 1.2.5 A few new features, a couple of bug fixes. 
     242 * 1.3.0 Adds support for customizing custom field groups. 
Note: See TracChangeset for help on using the changeset viewer.