Plugin Directory

Changeset 1135794


Ignore:
Timestamp:
04/16/2015 01:31:05 AM (11 years ago)
Author:
strider72
Message:

2.6 = (15 April 2015)

  • Added Setting to put the Style and Script links in the page footer, and set "footer" to default
  • Updated hook for Settings link on Plugins page
  • Updated PHP4-style constructor function
  • Moved a bit of JavaScript into linked file
  • Minor code cleanup
Location:
graceful-pull-quotes/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • graceful-pull-quotes/trunk/graceful-pull-quotes.php

    r1101716 r1135794  
    66Author: Stephen Rider
    77Author URI: http://striderweb.com/nerdaphernalia
    8 Version: 2.5
    9 Date: 2015-02-17
     8Version: 2.6
     9Date: 2015-04-15
    1010Text Domain: jspullquotes
    1111Domain Path: /lang
     
    1515
    1616/* To Do
     17    FIXME:  When script renders HTML comment content, it needs to encode characters and NOT encode tags!  related: http://core.trac.wordpress.org/ticket/8912 or 3603
    1718    TODO:   allow user to specify location of "styles" folder
    1819        - replace $style_path and $style_url with user options
     
    2021    TODO:   find better way to combine style and "core" CSS files into single call
    2122    TODO:   (??) Allow for semi-random styling
    22     TODO:   Fix encoding bug for extended ASCII text in alt-text comments
    23             -   Maybe related to WP core bug: http://core.trac.wordpress.org/ticket/8912 or 3603
    2423    TODO:   Option: [B]racket-capitalize quotes starting with lowercase letter
    2524    TODO:  Make first-letter capitalization optional
    2625*/
    2726
    28     var $option_version = '2.1.2';
     27    var $option_version = '2.6';
    2928    var $option_name = 'plugin_jspullquotes_settings';
    3029    var $option_bools = array ( 'alt_sides', 'alt_text', 'skip_links', 'skip_internal_links', 'omit_styles' );
    3130    var $tdSlug = 'jspullquotes';
    3231
    33     function jspullquotes() {
     32    function __construct() {
    3433
    3534        if ( ! defined( 'WP_CONTENT_DIR' ) )
     
    4443        $this->plugin_dir = ( dirname( __FILE__ ) );
    4544        $this->plugin_url = trailingslashit( WP_PLUGIN_URL ) . basename( dirname( __FILE__ ) );
    46 // TODO: turn these into user options:
     45// TODO: turn style_dir/url into user options:
    4746        $this->style_dir = $this->plugin_dir . '/styles';
    4847        $this->style_url = $this->plugin_url . '/styles';
     
    6160
    6261        register_activation_hook( __FILE__, array( &$this, 'get_options' ) );
    63         add_action( 'wp_head', array( &$this, 'wp_head' ) );
    6462        add_action( 'admin_menu', array( &$this, 'add_settings_page' ) );
     63
     64        $this->hook_header_links();
     65    }
     66
     67    function hook_header_links() {
     68        $options = $this->get_options();
     69        if ( $options['links_location'] == 'footer' ) {
     70            add_action( 'wp_print_footer_scripts', array( &$this, 'wp_head' ) );
     71        } else {
     72            add_action( 'wp_head', array( &$this, 'wp_head' ) );
     73        }
    6574    }
    6675
     
    99108            'omit_styles' => false,
    100109            'quote_class' => 'pullquote',
    101             'quote_class_alt' => 'pullquote pqRight' );
     110            'quote_class_alt' => 'pullquote pqRight',
     111            'links_location' => 'footer'
     112        );
    102113        if ( 'reset' == $mode ) {
    103114            delete_option( $this->option_name );
     
    135146                    $options[$bool] = $options[$bool] ? true : false;
    136147                }
    137                 if ( $options['style_name'] ) {
     148                if ( isset( $options['style_name'] ) ) {
    138149                    if ( '.css' != substr( $options['style_name'], -4 ) ) {
    139150                        $options['style_name'] .= '/pullquote.css';
     
    146157                    unset( $options['style_url'] );
    147158                }
    148                 if ( $options['last_used'] ) unset( $options['last_used'] );
     159                if ( isset( $options['last_used'] ) ) unset( $options['last_used'] );
    149160
    150161                $options = $this->set_defaults( 'merge', $options );
     
    204215    }
    205216
    206 // Add the links to the <head> of each blog page
     217// Add the links to the blog page
    207218    function wp_head() {
    208219        $options = $this->get_options();
     
    222233            $stylelinks = <<<EOT
    223234    <link rel="stylesheet" href="{$this->plugin_url}/resources/jspullquotes-core.css" type="text/css" />
    224     <link rel="stylesheet" href="{$currStyle}" type="text/css" />\n
     235    <link rel="stylesheet" href="{$currStyle}" type="text/css" />
    225236EOT;
    226237        }
    227238        echo <<<EOT
    228239<!-- Graceful Pull-Quotes plugin v{$plugin_version} -->
    229 {$stylelinks}   <script type="text/javascript" src="{$this->plugin_url}/resources/jspullquotes.js"></script>
     240{$stylelinks}
    230241    <script type="text/javascript">
    231242        var jspq_options = new Array({$optionsarray});
    232         pullQuoteOpts(jspq_options);
    233243    </script>
     244    <script type="text/javascript" src="{$this->plugin_url}/resources/jspullquotes.js"></script>
    234245<!-- end pull-quote additions -->\n
    235246EOT;
     
    248259            add_action( "admin_print_scripts-$page", array( &$this, 'admin_head' ) );
    249260
    250             add_filter( 'plugin_action_links', array( &$this, 'filter_plugin_actions' ), 10, 2 );
     261            add_filter( 'plugin_action_links_'.plugin_basename( __FILE__ ), array( &$this, 'filter_plugin_actions' ) );
    251262            add_filter( 'ozh_adminmenu_icon', array( &$this, 'add_ozh_adminmenu_icon' ) );
    252263        }
     
    269280
    270281// Add action link(s) to plugins page
    271     function filter_plugin_actions( $links, $file ) {
    272         //Static so we don't call plugin_basename on every plugin row.
    273         static $this_plugin;
    274         if ( ! $this_plugin ) $this_plugin = plugin_basename( __FILE__ );
    275 
    276         if ( $file == $this_plugin ){
    277             $settings_link = '<a href="themes.php?page=pull-quotes">' . __('Settings') . '</a>';
    278             array_unshift( $links, $settings_link ); // before other links
    279         }
     282    function filter_plugin_actions( $links ) {
     283        $settings_link = '<a href="themes.php?page=pull-quotes">' . __('Settings') . '</a>';
     284        array_unshift( $links, $settings_link ); // before other links
    280285        return $links;
    281286    }
     
    287292    }
    288293
    289 // these three functions are used by the settings page to display set options in the form controls when the page is opened
    290 
     294// this function is used by the settings page to display set options in the form controls when the page is opened
    291295// for text boxes or textarea
    292296    function checktext( $options, $optname, $optdefault = '' ) {
     
    307311            echo '<div id="message" class="updated fade"><p><strong>' . __('Settings saved.') . '</strong></p></div>';
    308312        }
    309        
     313
    310314        // get options for use in form-setting functions
    311315        $opts = $this->get_options();
     
    378382<?php
    379383        $cmbq_container = '<select name="' . $this->option_name . '[q_container]" id="q_container">
     384                            <option value="aside"' . selected( $opts['q_container'], 'aside', false ) . '>&lt;aside&gt; (default)</option>
    380385                            <option value="blockquote"' . selected( $opts['q_container'], 'blockquote', false ) . '>&lt;blockquote&gt;</option>
    381                             <option value="aside"' . selected( $opts['q_container'], 'aside', false ) . '>&lt;aside&gt;</option>
    382386                            <option value="div"' . selected( $opts['q_container'], 'div', false ) . '>&lt;div&gt;</option>
     387                        </select>';
     388        $cmbg_links_location = '<select name="' . $this->option_name . '[links_location]" id="links_location">
     389                            <option value="head"' . selected( $opts['links_location'], 'head', false ) . '>Page Head</option>
     390                            <option value="footer"' . selected( $opts['links_location'], 'footer', false ) . '>Page Footer (default)</option>
    383391                        </select>';
    384392?>
     
    397405                <tr valign="top">
    398406                    <th scope="row"><abbr title="<?php _e( 'Cascading Style Sheets', $this->tdSlug ); ?>">CSS</abbr></th>
    399                     <td><label for="omit_styles"><input type="checkbox" name="<?php echo $this->option_name; ?>[omit_styles]" id="omit_styles" value="true"<?php checked( $opts['omit_styles'] ); ?> /> <?php _e( 'Do not link CSS', $this->tdSlug ); ?></label><br /><?php _e( 'Check this if you prefer to manually put your pull-quote styles elsewhere', $this->tdSlug ); ?><br />
     407                    <td>
     408                        <label for="omit_styles"><input type="checkbox" name="<?php echo $this->option_name; ?>[omit_styles]" id="omit_styles" value="true"<?php checked( $opts['omit_styles'] ); ?> /> <?php _e( 'Do not link CSS', $this->tdSlug ); ?></label><br /><?php _e( 'Check this if you prefer to manually put your pull-quote styles elsewhere', $this->tdSlug ); ?><br />
    400409                        <br />
    401410                        <input type="text" name="<?php echo $this->option_name ?>[quote_class]" id="quote_class" value="<?php echo( $this->checktext( $opts,'quote_class','pullquote' ) ); ?>" /><label for="quote_class"> <?php _e( 'Class selector for default pull-quote', $this->tdSlug ); ?></label><br />
    402411                        <input type="text" name="<?php echo $this->option_name ?>[quote_class_alt]" id="quote_class_alt" value="<?php echo( $this->checktext( $opts, 'quote_class_alt', 'pullquote pqRight' ) ); ?>"/><label for="quote_class_alt"> <?php _e( 'Class selector for alt-side pull-quote', $this->tdSlug ); ?></label>
    403412                    </td>
     413                </tr>
     414                <tr valign="top">
     415                    <th scope="row"><?php _e( 'Links Location', $this->tdSlug ); ?></th>
     416                    <td><label for="links_location">
     417                            <?php echo $cmbg_links_location . ' ' . __( 'Where on the page the Style and Script links will be written', $this->tdSlug ) ?></label></td>
    404418                </tr>
    405419            </tbody>
     
    416430    // DEPRECATED -- maybe safe to remove
    417431
     432    /*
    418433    function p__( $text ) {
    419434        _deprecated_function( __FUNCTION__, 'Graceful Pull-Quotes 2.5', '__()' );
     
    431446    }
    432447
    433 // for dropdowns
     448    // for dropdowns
    434449    function checkcombo( $options, $optname, $thisopt, $is_default = false ) {
    435450        _deprecated_function( __FUNCTION__, 'Graceful Pull-Quotes 2.5', 'selected()' );
     
    439454        ) ? ' selected="selected"' : '';
    440455    }
    441 
     456    */
    442457} // end class
    443458
  • graceful-pull-quotes/trunk/readme.txt

    r1101715 r1135794  
    55Requires at least: 2.6
    66Tested up to: 4.1
    7 Stable tag: 2.5
     7Stable tag: 2.6
    88
    99Allows you to make pull-quotes without duplicating content. If the plugin is disabled the pull-quotes disappear seamlessly.
     
    8282
    8383== Changelog ==
     84
     85= 2.6 = (15 April 2015)
     86* Added Setting to put the Style and Script links in the page footer, and set "footer" to default
     87* Updated hook for Settings link on Plugins page
     88* Updated PHP4-style constructor function
     89* Moved a bit of JavaScript into linked file
     90* Minor code cleanup
    8491
    8592= 2.5 (17 February 2015) =
     
    93100* Pull-quote text in an HTML comment is now trimmed of spaces
    94101* Improved testing for empty pull-quotes before rendering
    95 * Bugfix: Was not saving container setting correctly -- error in HTML rendering on Settings page.
     102* Bugfix: Was not saving container setting correctly -- error in HTML rendering on Settings page
    96103
    97104= 2.4.1 (3 September 2011) =
     
    101108* Updated filenames to reflect new plugin name.
    102109* Updated .po localization files to reflect current code (calling all translators!)
    103 * A few more tweaks in preparation for adding plugin to the Official WP Extend repository.
     110* A few more tweaks in preparation for adding plugin to the Official WP Extend repository
    104111
    105112= 2.3 (28 March 2010) =
  • graceful-pull-quotes/trunk/resources/jspullquotes.js

    r1092768 r1135794  
    183183    pullquote.addEvent(window, 'load', function(){pullquote.init(arrOptions);});
    184184}
     185
     186pullQuoteOpts(jspq_options);
Note: See TracChangeset for help on using the changeset viewer.