WordPress.org

Plugin Directory

Changeset 760864


Ignore:
Timestamp:
08/22/13 18:47:51 (8 months ago)
Author:
joedolson
Message:

Update - japanese, gaelic, new feature: pull styles from library.

Location:
wp-post-styling/trunk
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • wp-post-styling/trunk/readme.txt

    r671858 r760864  
    44Tags: css, post, page, custom, css, admin, mobile, print, design 
    55Requires at least: 2.5 
    6 Tested up to: 3.5.1 
     6Tested up to: 3.6 
    77Stable tag: trunk 
    88 
     
    1111== Description == 
    1212 
    13 This plugin provides a custom field on your WordPress interface where you can add custom styles to be applied only on that page or post. Useful for being able to publish articles with a unique look. 
     13Adds a custom field to your post editing screens to add custom styles applied only on that page or post. 
    1414 
    15 You can attach custom styles to any page, post, or custom post type. Separate styles can be attached for print, screen, or mobile. You can also store your own library of frequently-used styles.  
    16  
    17 The use you'll get out of this plugin depends on the flexibility of the theme you're using and your own knowledge of CSS (Cascading Style Sheets). 
     15Attach custom styles to any page, post, or custom post type. Separate styles can be attached for print, screen, or mobile. You can also store your own library of frequently-used styles.  
    1816 
    1917How to use the style library: 
     
    24221. Update or post the new document. 
    2523 
    26 A newly-selected style from the style library will always overwrite any previous hand-written styles. If you wish to alter the library styles for a specific page, you can do this in the textarea after you've saved the page with the style library template. Editing your saved stylesheets will have no impact on previously saved post-specific styles.  
     24A newly-selected style from the style library will always overwrite any previous hand-written styles. If you wish to alter the library styles for a specific page, you can do this in the textarea after you've saved the page with the style library template. 
     25 
     26By default, editing your saved stylesheets will have no impact on previously saved post-specific styles; set the option to pull styles from the library to change this.  
    2727 
    2828Note: custom styles will not be included on archive pages; only on single post/Page views. 
    2929 
     30The use you'll get out of this plugin depends on the flexibility of the theme you're using and your own knowledge of CSS (Cascading Style Sheets). 
     31 
     32= Translations = 
     33 
     34Available languages (in order of completeness): 
     35Japanese, Irish, Russian 
     36 
     37Visit the [WP Post Styling translations site](http://translate.joedolson.com/projects/wp-post-styling) to check the progress of a translation. 
     38 
    3039Translating my plug-ins is always appreciated. Visit <a href="http://translate.joedolson.com">my translations site</a> to start getting your language into shape! 
    3140 
     41<a href="http://www.joedolson.com/articles/translator-credits/">Translator Credits</a> 
     42 
    3243== Changelog == 
     44 
     45= 1.2.7 = 
     46 
     47* Added languages: Irish Gaelic, Japanese 
     48* New feature: Use styles directly from the library. 
    3349 
    3450= 1.2.6 = 
  • wp-post-styling/trunk/wp-post-styling-manager.php

    r671858 r760864  
    55        update_option( 'jd-post-styling-screen', '1' ); 
    66        update_option( 'post-styling-initial', '1' ); 
    7         update_option( 'jd-posts-styling-default', 'enable' ); 
     7        update_option( 'jd-post-styling-default', '1' ); 
     8        update_option( 'jd-post-styling-library', '0' );         
    89        update_option( 'jd-post-styling-boxsize', '6' ); 
    910    } 
     
    1112    if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'options' ) { 
    1213        //UPDATE OPTIONS 
    13         update_option( 'jd-post-styling-screen', $_POST['jd-post-styling-screen'] ); 
    14         update_option( 'jd-post-styling-mobile', $_POST['jd-post-styling-mobile'] ); 
    15         update_option( 'jd-post-styling-print', $_POST['jd-post-styling-print'] ); 
    16         update_option( 'jd-post-styling-default', $_POST['jd-post-styling-default'] ); 
    17         update_option( 'jd-post-styling-boxsize', $_POST['jd-post-styling-boxsize'] ); 
     14        update_option( 'jd-post-styling-screen', ( isset( $_POST['jd-post-styling-screen'] ) )?1:0 ); 
     15        update_option( 'jd-post-styling-mobile', ( isset( $_POST['jd-post-styling-mobile'] ) )?1:0 ); 
     16        update_option( 'jd-post-styling-print', ( isset( $_POST['jd-post-styling-print'] ) )?1:0 ); 
     17        update_option( 'jd-post-styling-default', ( isset( $_POST['jd-post-styling-default'] ) )?1:0 ); 
     18        update_option( 'jd-post-styling-library', ( isset( $_POST['jd-post-styling-library'] ) )?1:0 ); 
     19        update_option( 'jd-post-styling-boxsize', (int) $_POST['jd-post-styling-boxsize'] ); 
    1820        $message = __("WP Post Styling Options Updated",'wp-post-styling'); 
    1921 
     
    2527        $message = "<ul>"; 
    2628            if ( $_POST[ 'jd_style_library_name' ] == "" ) { 
    27             $message .= "<li>" . __("Please enter a name for this Style Library record.",'wp-post-styling') . "</li>"; 
     29                $message .= "<li>" . __("Please enter a name for this Style Library record.",'wp-post-styling') . "</li>"; 
    2830            } 
    2931            if ( $_POST[ 'jd_style_library_css' ] == "" ) { 
    30             $message .= "<li>" . __("Please enter styling instructions for this Style Library record.",'wp-post-styling') . "</li>";         
     32                $message .= "<li>" . __("Please enter styling instructions for this Style Library record.",'wp-post-styling') . "</li>";         
    3133            } 
    3234            if ( $_POST[ 'jd_style_library_type' ] == "" ) { 
    33             $message .= "<li>" . __("Please select a type for this Style Library record.",'wp-post-styling') . "</li>";      
     35                $message .= "<li>" . __("Please select a type for this Style Library record.",'wp-post-styling') . "</li>";      
    3436            }    
    3537        $message .= "</ul>"; 
     
    4749            if ( $results == TRUE ) { 
    4850                if ( $type == "update" ) { 
    49                 $message = __("WP Post Styling Library Updated",'wp-post-styling'); 
     51                    $message = __("WP Post Styling Library Updated",'wp-post-styling'); 
    5052                } elseif ( $type == "delete" ) { 
    51                 $message = __("Record Deleted from WP Post Styling Library",'wp-post-styling');              
     53                    $message = __("Record Deleted from WP Post Styling Library",'wp-post-styling');              
    5254                } elseif ( $type == "insert" ) { 
    53                 $message = __("Recorded Added to WP Post Styling Library",'wp-post-styling');                
     55                    $message = __("Record Added to WP Post Styling Library",'wp-post-styling');              
    5456                } 
    5557            } else { 
     
    7072    } 
    7173    // FUNCTION to see if checkboxes should be checked 
    72     if ( !function_exists('jd_checkCheckbox') ) { 
    73         function jd_checkCheckbox( $theFieldname ){ 
     74    if ( !function_exists('wps_checkbox') ) { 
     75        function wps_checkbox( $theFieldname ){ 
    7476            if( get_option( $theFieldname ) == '1'){ 
    7577                echo 'checked="checked"'; 
     
    8183<div id="message" class="updated fade"><p><?php echo $message; ?></p></div> 
    8284<?php endif; ?> 
    83 <div id="dropmessage" class="updated" style="display:none;"></div> 
    84  
    85     <?php global $wp_version; if ( version_compare( $wp_version,"2.7",">" )) { 
    86     echo "<div class=\"wrap\">"; 
    87     } ?> 
     85<?php global $wp_version; if ( version_compare( $wp_version,"2.7",">" )) {  echo "<div class=\"wrap\">"; } ?> 
    8886 
    8987<div id="wp-post-styling"> 
     
    9189 
    9290<div class="resources"> 
    93 <p> 
    94 <a href="https://twitter.com/intent/tweet?screen_name=joedolson&text=WP%20Post%20Styling%20is%20great%20-%20Thanks!" class="twitter-mention-button" data-size="large" data-related="joedolson">Tweet to @joedolson</a> 
    95 <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> 
    96 </p> 
    97 <ul> 
    98 <li><a href="http://www.joedolson.com/articles/wp-post-styling/"><?php _e("Get Support",'wp-post-styling'); ?></a></li> 
    99 <li><a href="http://www.joedolson.com/articles/bugs/"><?php _e("Report a bug",'wp-post-styling'); ?></a></li> 
    100 <li><a href="http://profiles.wordpress.org/joedolson"><?php _e("Check out my other plug-ins",'wp-post-styling'); ?></a></li> 
    101 <li><form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
    102 <div> 
    103 <input type="hidden" name="cmd" value="_s-xclick" /> 
    104 <input type="hidden" name="hosted_button_id" value="5C4T2NCL4GEBE" /> 
    105 <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" name="submit" alt="Donate!" /> 
    106 <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /> 
    107 </div> 
    108 </form> 
    109 </li> 
    110 </ul> 
     91    <p> 
     92        <a href="https://twitter.com/intent/tweet?screen_name=joedolson&text=WP%20Post%20Styling%20is%20great%20-%20Thanks!" class="twitter-mention-button" data-size="large" data-related="joedolson">Tweet to @joedolson</a> 
     93        <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> 
     94    </p> 
     95    <ul> 
     96        <li><a href="http://www.joedolson.com/articles/wp-post-styling/"><?php _e("Get Support",'wp-post-styling'); ?></a></li> 
     97        <li><a href="http://www.joedolson.com/articles/bugs/"><?php _e("Report a bug",'wp-post-styling'); ?></a></li> 
     98        <li><a href="http://profiles.wordpress.org/joedolson"><?php _e("Check out my other plug-ins",'wp-post-styling'); ?></a></li> 
     99        <li><form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
     100        <div> 
     101        <input type="hidden" name="cmd" value="_s-xclick" /> 
     102        <input type="hidden" name="hosted_button_id" value="5C4T2NCL4GEBE" /> 
     103        <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" name="submit" alt="Donate!" /> 
     104        <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /> 
     105        </div> 
     106        </form> 
     107        </li> 
     108    </ul> 
    111109</div> 
    112110 
     
    151149            <legend><?php _e('WordPress Post Styling Options','wp-post-styling'); ?></legend> 
    152150            <p> 
    153                 <input type="checkbox" name="jd-post-styling-screen" id="jd-post-styling-screen" value="1" <?php jd_checkCheckbox('jd-post-styling-screen')?> /> 
    154                 <label for="jd-post-styling-screen"><strong><?php _e('Add Custom Screen Styles','wp-post-styling'); ?></strong></label> 
     151                <input type="checkbox" name="jd-post-styling-screen" id="wps-screen" value="1" <?php wps_checkbox('jd-post-styling-screen'); ?> /> 
     152                <label for="wps-screen"><strong><?php _e('Add Custom Screen Styles','wp-post-styling'); ?></strong></label> 
    155153            </p> 
    156154            <p> 
    157                 <input type="checkbox" name="jd-post-styling-mobile" id="jd-post-styling-mobile" value="1" <?php jd_checkCheckbox('jd-post-styling-mobile')?> /> 
    158                 <label for="jd-post-styling-mobile"><strong><?php _e('Add Custom Mobile Styles','wp-post-styling'); ?></strong></label> 
     155                <input type="checkbox" name="jd-post-styling-mobile" id="wps-mobile" value="1" <?php wps_checkbox('jd-post-styling-mobile'); ?> /> 
     156                <label for="wps-mobile"><strong><?php _e('Add Custom Mobile Styles','wp-post-styling'); ?></strong></label> 
    159157            </p> 
    160158            <p>              
    161                 <input type="checkbox" name="jd-post-styling-print" id="jd-post-styling-print" value="1" <?php jd_checkCheckbox('jd-post-styling-print')?> /> 
    162                 <label for="jd-post-styling-print"><strong><?php _e('Add Custom Print Styles','wp-post-styling'); ?></strong></label> 
     159                <input type="checkbox" name="jd-post-styling-print" id="wps-print" value="1" <?php wps_checkbox('jd-post-styling-print'); ?> /> 
     160                <label for="wps-print"><strong><?php _e('Add Custom Print Styles','wp-post-styling'); ?></strong></label> 
    163161            </p> 
    164162            <p>              
    165                 <input type="checkbox" name="jd-post-styling-default" id="jd-post-styling-default" value="disable" <?php jd_checkCheckbox('jd-post-styling-default')?> /> 
    166                 <label for="jd-post-styling-default"><strong><?php _e('Disable Custom Styles as default condition','wp-post-styling'); ?></strong></label>               
     163                <input type="checkbox" name="jd-post-styling-default" id="wps-default" value="disable" <?php wps_checkbox('jd-post-styling-default'); ?> /> 
     164                <label for="wps-default"><strong><?php _e('Disable Custom Styles as default condition','wp-post-styling'); ?></strong></label>               
    167165            </p> 
    168166            <p>              
    169                 <input type="text" name="jd-post-styling-boxsize" id="jd-post-styling-boxsize" value="<?php echo get_option('jd-post-styling-boxsize'); ?>" size="3" /> 
    170                 <label for="jd-post-styling-boxsize"><strong><?php _e('Size of custom style text box (in lines.)','wp-post-styling'); ?></strong></label>                
     167                <input type="checkbox" name="jd-post-styling-library" id="wps-library" value="disable" <?php wps_checkbox('jd-post-styling-library'); ?> /> 
     168                <label for="wps-library"><strong><?php _e('Pull Post Styles Directly from Library','wp-post-styling'); ?></strong></label>               
     169            </p>             
     170            <p>              
     171                <input type="text" name="jd-post-styling-boxsize" id="wps-boxsize" value="<?php echo get_option('jd-post-styling-boxsize'); ?>" size="3" /> 
     172                <label for="wps-boxsize"><strong><?php _e('Size of custom style text box (in lines.)','wp-post-styling'); ?></strong></label>                
    171173            </p> 
    172174        </fieldset> 
    173         <div> 
    174         <input type="hidden" name="submit-type" value="options" /> 
    175         </div> 
    176         <p> 
    177         <input type="submit" name="submit" class="button-primary"  value="<?php _e('Save WP Post Styling Options','wp-post-styling'); ?>" /> 
    178         </p> 
     175        <div><input type="hidden" name="submit-type" value="options" /></div> 
     176        <p><input type="submit" name="submit" class="button-primary"  value="<?php _e('Save WP Post Styling Options','wp-post-styling'); ?>" /></p> 
    179177    </form> 
    180178</div> 
  • wp-post-styling/trunk/wp-post-styling.php

    r671858 r760864  
    44Plugin URI: http://www.joedolson.com/articles/wp-post-styling/ 
    55Description: Allows you to define custom styles for any specific post or page on your WordPress site. Helps reduce clutter in your stylesheet. 
    6 Version: 1.2.6 
     6Version: 1.2.7 
    77Author: Joseph Dolson 
    88Author URI: http://www.joedolson.com/ 
     
    5858    jd_fix_post_style_meta(); 
    5959} 
    60 $version = '1.2.6'; 
    61 update_option( 'wp_post_styling_version',$version ); 
     60$wps_version = '1.2.7'; 
     61update_option( 'wp_post_styling_version',$wps_version ); 
    6262 
    6363// Exit if below version requirements 
     
    129129}    
    130130 
    131 function jd_post_style_library_selector($library="screen") { 
     131function jd_post_style_library_selector( $library="screen", $selected='' ) { 
    132132    // select library items from database where library is $library 
    133133    global $wpdb; 
     
    135135    $dbtable = $prefix . 'post_styling_library'; 
    136136    $results = $wpdb->get_results( 
    137         "SELECT `name`, `css` 
     137        "SELECT `id`, `name`, `css` 
    138138        FROM `$dbtable` 
    139139        WHERE `type` = '$library' 
    140140        ORDER BY name ASC 
    141141        "); 
    142          
     142     
    143143    if (count($results)) { 
    144144        foreach ($results as $result) { 
    145             echo '<option value="'. htmlspecialchars($result->css).'">'. ($result->name) .'</option>'."\n"; 
     145            if ( get_option( 'jd-post-styling-library' ) == 1 ) {  
     146                $value = (int) $result->id; 
     147                $checked = ( $selected == $value )?' selected="selected"':'';    
     148            } else { 
     149                $value = htmlspecialchars($result->css); 
     150                $checked = ''; 
     151            } 
     152            echo '<option value="'.$value.'"'.$checked.'>'. ($result->name) .'</option>'."\n"; 
    146153        } 
    147154    } else { 
     
    246253    ?> 
    247254    <?php if ( get_option( 'jd-post-styling-screen' ) == '1' ) { ?> 
    248     <p> 
    249     <label for="jd_post_styling_screen"><?php _e('Custom Screen Styles For This Post', 'wp-post-styling'); ?></label><br /><textarea name="jd_post_styling_screen" id="jd_post_styling_screen" rows="<?php echo $jd_box_size; ?>" cols="70"><?php echo $jd_post_styling_screen; ?></textarea> 
    250     </p> 
    251     <p> 
    252     <label for="jd_post_styling_screen_library"><?php _e('Custom Screen Style Library','wp-post-styling'); ?></label><br /><select id="jd_post_styling_screen_library" name="jd_post_styling_screen_library"> 
    253     <option value="none">Select library style</option> 
    254     <?php jd_post_style_library_selector("screen"); ?> 
    255     </select> 
    256     </p> 
     255        <?php if ( get_option( 'jd-post-styling-library' ) != 1 ) { ?> 
     256            <p> 
     257            <label for="jd_post_styling_screen"><?php _e('Custom Screen Styles For This Post', 'wp-post-styling'); ?></label> 
     258                <br /><textarea name="jd_post_styling_screen" id="jd_post_styling_screen" rows="<?php echo $jd_box_size; ?>" cols="70"><?php echo $jd_post_styling_screen; ?></textarea> 
     259            </p> 
     260        <?php } ?>   
     261        <p> 
     262        <label for="jd_post_styling_screen_library"><?php _e('Custom Screen Style Library','wp-post-styling'); ?></label><br /><select id="jd_post_styling_screen_library" name="jd_post_styling_screen_library"> 
     263        <option value="none"><?php _e( 'Select library style', 'wp-post-styling' ); ?></option> 
     264        <?php jd_post_style_library_selector("screen", $jd_post_styling_screen ); ?> 
     265        </select> 
     266        </p> 
    257267    <?php } ?> 
    258268     
    259269    <?php if ( get_option( 'jd-post-styling-mobile' ) == '1' ) { ?> 
    260     <p> 
    261     <label for="jd_post_styling_mobile"><?php _e('Custom Mobile Styles For This Post', 'wp-post-styling') ?></label><br /><textarea name="jd_post_styling_mobile" id="jd_post_styling_mobile" rows="<?php echo $jd_box_size; ?>" cols="70"><?php echo $jd_post_styling_mobile ?></textarea> 
    262     </p> 
     270        <?php if ( get_option( 'jd-post-styling-library' ) != 1 ) { ?> 
     271            <p> 
     272            <label for="jd_post_styling_mobile"><?php _e('Custom Mobile Styles For This Post', 'wp-post-styling') ?></label><br /><textarea name="jd_post_styling_mobile" id="jd_post_styling_mobile" rows="<?php echo $jd_box_size; ?>" cols="70"><?php echo $jd_post_styling_mobile ?></textarea> 
     273            </p> 
     274        <?php } ?> 
    263275        <p> 
    264     <label for="jd_post_styling_mobile_library"><?php _e('Custom Mobile Style Library','wp-post-styling'); ?></label><br /><select id="jd_post_styling_mobile_library" name="jd_post_styling_mobile_library"> 
    265     <option value="none">Select library style</option> 
    266     <?php jd_post_style_library_selector("mobile"); ?>   
    267     </select> 
    268     </p> 
     276        <label for="jd_post_styling_mobile_library"><?php _e('Custom Mobile Style Library','wp-post-styling'); ?></label><br /><select id="jd_post_styling_mobile_library" name="jd_post_styling_mobile_library"> 
     277        <option value="none"><?php _e( 'Select library style', 'wp-post-styling' ); ?></option> 
     278        <?php jd_post_style_library_selector("mobile", $jd_post_styling_mobile); ?>  
     279        </select> 
     280        </p> 
    269281    <?php } ?> 
    270282     
    271283    <?php if ( get_option( 'jd-post-styling-print' ) == '1' ) { ?> 
    272     <p> 
    273     <label for="jd_post_styling_print"><?php _e('Custom Print Styles For This Post', 'wp-post-styling') ?></label><br /><textarea name="jd_post_styling_print" id="jd_post_styling_print" rows="<?php echo $jd_box_size; ?>" cols="70"><?php echo $jd_post_styling_print ?></textarea> 
    274     </p> 
    275     <p> 
    276     <label for="jd_post_styling_print_library"><?php _e('Custom Print Style Library','wp-post-styling'); ?></label><br /><select id="jd_post_styling_print_library" name="jd_post_styling_print_library"> 
    277     <option value="none">Select library style</option> 
    278     <?php jd_post_style_library_selector("print"); ?> 
    279     </select> 
    280     </p>     
     284        <?php if ( get_option( 'jd-post-styling-library' ) != 1 ) { ?> 
     285            <p> 
     286            <label for="jd_post_styling_print"><?php _e('Custom Print Styles For This Post', 'wp-post-styling') ?></label><br /><textarea name="jd_post_styling_print" id="jd_post_styling_print" rows="<?php echo $jd_box_size; ?>" cols="70"><?php echo $jd_post_styling_print ?></textarea> 
     287            </p> 
     288        <?php } ?> 
     289        <p> 
     290        <label for="jd_post_styling_print_library"><?php _e('Custom Print Style Library','wp-post-styling'); ?></label><br /><select id="jd_post_styling_print_library" name="jd_post_styling_print_library"> 
     291        <option value="none"><?php _e( 'Select library style', 'wp-post-styling' ); ?></option> 
     292        <?php jd_post_style_library_selector("print", $jd_post_styling_print ); ?> 
     293        </select> 
     294        </p>     
    281295    <?php } ?> 
    282296    <p><a target="__blank" href="http://www.joedolson.com/articles/wp-post-styling/"><?php _e('Get Support', 'wp-post-styling') ?></a> &raquo; 
     
    309323// Post the custom styles into the post meta table 
    310324function set_jd_post_styling( $id ) { 
    311     if (isset($_POST['jd_post_styling_screen'])) { 
    312         $jd_post_styling_screen = $_POST[ 'jd_post_styling_screen' ]; 
    313         $jd_post_styling_screen_library = $_POST[ 'jd_post_styling_screen_library' ]; 
    314             if ($jd_post_styling_screen_library == "none") { 
    315                 if (isset($jd_post_styling_screen) && !empty($jd_post_styling_screen)) { 
    316                 update_post_meta( $id, '_jd_post_styling_screen', $jd_post_styling_screen ); 
     325    // consider: add option to pull styles by reference instead of from post meta.  
     326    if ( isset($_POST['jd_post_styling_screen_library']) ) { 
     327        $screen = $_POST[ 'jd_post_styling_screen' ]; 
     328        $library = $_POST[ 'jd_post_styling_screen_library' ]; 
     329        if ( !isset( $_POST['jd_post_styling_screen']) ) { 
     330            $screen = (int) $library; 
     331        } 
     332            if ( $library == "none" ) { 
     333                if ( isset($screen) && !empty($screen) ) { 
     334                    update_post_meta( $id, '_jd_post_styling_screen', $screen ); 
    317335                } 
    318336            } else { 
    319                 update_post_meta( $id, '_jd_post_styling_screen', $jd_post_styling_screen_library ); 
    320             } 
    321     } 
    322     if (isset($_POST['jd_post_styling_print'])) { 
    323         $jd_post_styling_print = $_POST[ 'jd_post_styling_print' ]; 
    324         $jd_post_styling_print_library = $_POST[ 'jd_post_styling_print_library' ]; 
    325             if ($jd_post_styling_print_library == "none") {  
    326                 if (isset($jd_post_styling_print) && !empty($jd_post_styling_print)) { 
    327                 update_post_meta( $id, '_jd_post_styling_print', $jd_post_styling_print ); 
     337                update_post_meta( $id, '_jd_post_styling_screen', $library ); 
     338            } 
     339    } 
     340    if (isset($_POST['jd_post_styling_print_library'])) { 
     341        $print = $_POST[ 'jd_post_styling_print' ]; 
     342        $library = $_POST[ 'jd_post_styling_print_library' ]; 
     343        if ( !isset( $_POST['jd_post_styling_print']) ) { 
     344            $screen = (int) $library; 
     345        }        
     346            if ($library == "none") {    
     347                if (isset($print) && !empty($print)) { 
     348                    update_post_meta( $id, '_jd_post_styling_print', $print ); 
    328349                } 
    329350            } else { 
    330                 update_post_meta( $id, '_jd_post_styling_print', $jd_post_styling_print_library ); 
     351                update_post_meta( $id, '_jd_post_styling_print', $library ); 
    331352            } 
    332353    } 
    333354    if (isset($_POST['jd_post_styling_mobile'])) { 
    334         $jd_post_styling_mobile = $_POST[ 'jd_post_styling_mobile' ]; 
    335         $jd_post_styling_mobile_library = $_POST[ 'jd_post_styling_mobile_library' ]; 
    336             if ($jd_post_styling_mobile_library == "none") {     
    337                 if (isset($jd_post_styling_mobile) && !empty($jd_post_styling_mobile)) { 
    338                 update_post_meta( $id, '_jd_post_styling_mobile', $jd_post_styling_mobile ); 
     355        $mobile = $_POST[ 'jd_post_styling_mobile' ]; 
     356        $library = $_POST[ 'jd_post_styling_mobile_library' ]; 
     357        if ( !isset( $_POST['jd_post_styling_mobile']) ) { 
     358            $screen = (int) $library; 
     359        }        
     360            if ($library == "none") {    
     361                if (isset($mobile) && !empty($mobile)) { 
     362                    update_post_meta( $id, '_jd_post_styling_mobile', $mobile ); 
    339363                }        
    340364            } else { 
    341                 update_post_meta( $id, '_jd_post_styling_mobile', $jd_post_styling_mobile_library ); 
     365                update_post_meta( $id, '_jd_post_styling_mobile', $library ); 
    342366            } 
    343367    } 
     
    359383    if (is_object($this_post)) { 
    360384    $id = $this_post->ID; 
    361     if ( get_post_meta( $id, '_jd_style_this', TRUE ) == 'enable' ) { 
    362 echo "<!-- Styles Added by WP Post Styling (http://www.joedolson.com/articles/wp-post-styling/) -->\n"; 
     385        if ( get_post_meta( $id, '_jd_style_this', TRUE ) == 'enable' ) { 
    363386            if ( get_post_meta( $id, '_jd_post_styling_screen', TRUE) != '') { 
    364             $this_post_styles = stripcslashes( get_post_meta( $id, '_jd_post_styling_screen', TRUE ) ); 
     387                $this_post_styles = stripcslashes( get_post_meta( $id, '_jd_post_styling_screen', TRUE ) ); 
     388                if ( get_option( 'jd-post-styling-library') == 1 )  { 
     389                    $this_post_styles = stripcslashes( jd_post_style_data($this_post_styles,'css') ); 
     390                } 
    365391            echo " 
    366392<style type='text/css' media='screen'>\n 
    367 $this_post_styles\n 
     393    $this_post_styles\n 
    368394</style>\n"; 
    369395            } 
    370396            if ( get_post_meta( $id, 'jd_post_styling_mobile', TRUE) != '' ) { 
    371             $this_post_styles = stripcslashes( get_post_meta( $id, '_jd_post_styling_mobile', TRUE ) ); 
     397                $this_post_styles = stripcslashes( get_post_meta( $id, '_jd_post_styling_mobile', TRUE ) ); 
     398                if ( get_option( 'jd-post-styling-library') == 1 ) { 
     399                    $this_post_styles = stripcslashes( jd_post_style_data($this_post_styles,'css') ); 
     400                }                
    372401            echo " 
    373402<style type='text/css' media='handheld'>\n 
    374 $this_post_styles\n 
     403    $this_post_styles\n 
    375404</style>\n"; 
    376405            } 
    377406            if ( get_post_meta( $id, 'jd_post_styling_print', TRUE) != '' ) { 
    378             $this_post_styles = stripcslashes( get_post_meta( $id, '_jd_post_styling_print', TRUE ) ); 
     407                $this_post_styles = stripcslashes( get_post_meta( $id, '_jd_post_styling_print', TRUE ) ); 
     408                if ( get_option( 'jd-post-styling-library') == 1 ) { 
     409                    $this_post_styles = stripcslashes( jd_post_style_data($this_post_styles,'css') ); 
     410                }            
    379411            echo " 
    380412<style type='text/css' media='print'>\n 
    381 $this_post_styles\n 
     413    $this_post_styles\n 
    382414</style>\n"; 
    383415            }    
    384 echo "<!-- End WP Post Styling -->\n";   
    385     } 
    386     } 
    387 } 
    388  
     416        } 
     417    } 
     418} 
    389419 
    390420// Add the administrative settings to the "Settings" menu. 
     
    434464add_action( 'wp_head','post_jd_post_styling' ); 
    435465register_activation_hook(__FILE__,'jd_create_post_styling_library_table'); 
    436  
    437 ?> 
Note: See TracChangeset for help on using the changeset viewer.