Changeset 1135794
- Timestamp:
- 04/16/2015 01:31:05 AM (11 years ago)
- Location:
- graceful-pull-quotes/trunk
- Files:
-
- 3 edited
-
graceful-pull-quotes.php (modified) (19 diffs)
-
readme.txt (modified) (4 diffs)
-
resources/jspullquotes.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
graceful-pull-quotes/trunk/graceful-pull-quotes.php
r1101716 r1135794 6 6 Author: Stephen Rider 7 7 Author URI: http://striderweb.com/nerdaphernalia 8 Version: 2. 59 Date: 2015-0 2-178 Version: 2.6 9 Date: 2015-04-15 10 10 Text Domain: jspullquotes 11 11 Domain Path: /lang … … 15 15 16 16 /* 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 17 18 TODO: allow user to specify location of "styles" folder 18 19 - replace $style_path and $style_url with user options … … 20 21 TODO: find better way to combine style and "core" CSS files into single call 21 22 TODO: (??) Allow for semi-random styling 22 TODO: Fix encoding bug for extended ASCII text in alt-text comments23 - Maybe related to WP core bug: http://core.trac.wordpress.org/ticket/8912 or 360324 23 TODO: Option: [B]racket-capitalize quotes starting with lowercase letter 25 24 TODO: Make first-letter capitalization optional 26 25 */ 27 26 28 var $option_version = '2. 1.2';27 var $option_version = '2.6'; 29 28 var $option_name = 'plugin_jspullquotes_settings'; 30 29 var $option_bools = array ( 'alt_sides', 'alt_text', 'skip_links', 'skip_internal_links', 'omit_styles' ); 31 30 var $tdSlug = 'jspullquotes'; 32 31 33 function jspullquotes() {32 function __construct() { 34 33 35 34 if ( ! defined( 'WP_CONTENT_DIR' ) ) … … 44 43 $this->plugin_dir = ( dirname( __FILE__ ) ); 45 44 $this->plugin_url = trailingslashit( WP_PLUGIN_URL ) . basename( dirname( __FILE__ ) ); 46 // TODO: turn theseinto user options:45 // TODO: turn style_dir/url into user options: 47 46 $this->style_dir = $this->plugin_dir . '/styles'; 48 47 $this->style_url = $this->plugin_url . '/styles'; … … 61 60 62 61 register_activation_hook( __FILE__, array( &$this, 'get_options' ) ); 63 add_action( 'wp_head', array( &$this, 'wp_head' ) );64 62 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 } 65 74 } 66 75 … … 99 108 'omit_styles' => false, 100 109 'quote_class' => 'pullquote', 101 'quote_class_alt' => 'pullquote pqRight' ); 110 'quote_class_alt' => 'pullquote pqRight', 111 'links_location' => 'footer' 112 ); 102 113 if ( 'reset' == $mode ) { 103 114 delete_option( $this->option_name ); … … 135 146 $options[$bool] = $options[$bool] ? true : false; 136 147 } 137 if ( $options['style_name']) {148 if ( isset( $options['style_name'] ) ) { 138 149 if ( '.css' != substr( $options['style_name'], -4 ) ) { 139 150 $options['style_name'] .= '/pullquote.css'; … … 146 157 unset( $options['style_url'] ); 147 158 } 148 if ( $options['last_used']) unset( $options['last_used'] );159 if ( isset( $options['last_used'] ) ) unset( $options['last_used'] ); 149 160 150 161 $options = $this->set_defaults( 'merge', $options ); … … 204 215 } 205 216 206 // Add the links to the <head> of eachblog page217 // Add the links to the blog page 207 218 function wp_head() { 208 219 $options = $this->get_options(); … … 222 233 $stylelinks = <<<EOT 223 234 <link rel="stylesheet" href="{$this->plugin_url}/resources/jspullquotes-core.css" type="text/css" /> 224 <link rel="stylesheet" href="{$currStyle}" type="text/css" /> \n235 <link rel="stylesheet" href="{$currStyle}" type="text/css" /> 225 236 EOT; 226 237 } 227 238 echo <<<EOT 228 239 <!-- Graceful Pull-Quotes plugin v{$plugin_version} --> 229 {$stylelinks} <script type="text/javascript" src="{$this->plugin_url}/resources/jspullquotes.js"></script>240 {$stylelinks} 230 241 <script type="text/javascript"> 231 242 var jspq_options = new Array({$optionsarray}); 232 pullQuoteOpts(jspq_options);233 243 </script> 244 <script type="text/javascript" src="{$this->plugin_url}/resources/jspullquotes.js"></script> 234 245 <!-- end pull-quote additions -->\n 235 246 EOT; … … 248 259 add_action( "admin_print_scripts-$page", array( &$this, 'admin_head' ) ); 249 260 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' ) ); 251 262 add_filter( 'ozh_adminmenu_icon', array( &$this, 'add_ozh_adminmenu_icon' ) ); 252 263 } … … 269 280 270 281 // 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 280 285 return $links; 281 286 } … … 287 292 } 288 293 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 291 295 // for text boxes or textarea 292 296 function checktext( $options, $optname, $optdefault = '' ) { … … 307 311 echo '<div id="message" class="updated fade"><p><strong>' . __('Settings saved.') . '</strong></p></div>'; 308 312 } 309 313 310 314 // get options for use in form-setting functions 311 315 $opts = $this->get_options(); … … 378 382 <?php 379 383 $cmbq_container = '<select name="' . $this->option_name . '[q_container]" id="q_container"> 384 <option value="aside"' . selected( $opts['q_container'], 'aside', false ) . '><aside> (default)</option> 380 385 <option value="blockquote"' . selected( $opts['q_container'], 'blockquote', false ) . '><blockquote></option> 381 <option value="aside"' . selected( $opts['q_container'], 'aside', false ) . '><aside></option>382 386 <option value="div"' . selected( $opts['q_container'], 'div', false ) . '><div></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> 383 391 </select>'; 384 392 ?> … … 397 405 <tr valign="top"> 398 406 <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 /> 400 409 <br /> 401 410 <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 /> 402 411 <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> 403 412 </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> 404 418 </tr> 405 419 </tbody> … … 416 430 // DEPRECATED -- maybe safe to remove 417 431 432 /* 418 433 function p__( $text ) { 419 434 _deprecated_function( __FUNCTION__, 'Graceful Pull-Quotes 2.5', '__()' ); … … 431 446 } 432 447 433 // for dropdowns448 // for dropdowns 434 449 function checkcombo( $options, $optname, $thisopt, $is_default = false ) { 435 450 _deprecated_function( __FUNCTION__, 'Graceful Pull-Quotes 2.5', 'selected()' ); … … 439 454 ) ? ' selected="selected"' : ''; 440 455 } 441 456 */ 442 457 } // end class 443 458 -
graceful-pull-quotes/trunk/readme.txt
r1101715 r1135794 5 5 Requires at least: 2.6 6 6 Tested up to: 4.1 7 Stable tag: 2. 57 Stable tag: 2.6 8 8 9 9 Allows you to make pull-quotes without duplicating content. If the plugin is disabled the pull-quotes disappear seamlessly. … … 82 82 83 83 == 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 84 91 85 92 = 2.5 (17 February 2015) = … … 93 100 * Pull-quote text in an HTML comment is now trimmed of spaces 94 101 * 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 96 103 97 104 = 2.4.1 (3 September 2011) = … … 101 108 * Updated filenames to reflect new plugin name. 102 109 * 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 104 111 105 112 = 2.3 (28 March 2010) = -
graceful-pull-quotes/trunk/resources/jspullquotes.js
r1092768 r1135794 183 183 pullquote.addEvent(window, 'load', function(){pullquote.init(arrOptions);}); 184 184 } 185 186 pullQuoteOpts(jspq_options);
Note: See TracChangeset
for help on using the changeset viewer.