Changeset 1850069
- Timestamp:
- 03/30/2018 03:07:13 PM (8 years ago)
- Location:
- rich-text-excerpts/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
rich-text-excerpts.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rich-text-excerpts/trunk/readme.txt
r1307423 r1850069 4 4 Tags: excerpt, editor, TinyMCE, formatting 5 5 Requires at least: 3.3 6 Tested up to: 4. 47 Stable tag: 1.3. 36 Tested up to: 4.9.4 7 Stable tag: 1.3.4 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl.html … … 77 77 == Changelog == 78 78 79 = 1.3.4 = 80 * started using admin_enqueue_scripts to enqueue all scripts and styles. 81 * Added icon 82 * Bumped "Tested up to" value to 4.9.4 83 79 84 = 1.3.3 = 80 85 * Incorporated *some* of the suggestions in [this forum post](https://wordpress.org/support/topic/css-to-remove-space) about the padding around the editor -
rich-text-excerpts/trunk/rich-text-excerpts.php
r1307423 r1850069 6 6 Author: Peter Edwards <pete@bjorsq.net> 7 7 Author URI: https://github.com/bjorsq/rich-text-excerpts 8 Version: 1.3. 38 Version: 1.3.4 9 9 Text Domain: rich-text-excerpts 10 10 License: GPLv3 … … 64 64 add_filter( 'teeny_mce_buttons', array( __CLASS__, 'teeny_mce_buttons' ), 10, 2 ); 65 65 /** 66 * register plugin admin options66 * create admin page, register plugin admin options and enqueue scripts/CSS 67 67 */ 68 68 add_action( 'admin_menu', array( __CLASS__, 'add_plugin_admin_menu' ) ); 69 69 add_action( 'admin_init', array( __CLASS__, 'register_plugin_options' ) ); 70 add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_plugin_scripts_styles' ) ); 70 71 71 72 /** … … 260 261 { 261 262 /* Plugin Options page */ 262 $options_page = add_submenu_page( 'options-general.php', __( 'Rich Text Excerpts', 'rich-text-excerpts' ), __( 'Rich Text Excerpts', 'rich-text-excerpts' ), "manage_options", "rich_text_excerpts_options", array( __CLASS__, "plugin_options_page" ) ); 263 /** 264 * Use the admin_print_scripts action to add scripts. 265 * Admin script is only needed on plugin admin page, but editor script is needed on all pages 266 * which include the editor 267 */ 268 add_action( 'admin_print_scripts-' . $options_page, array( __CLASS__, 'plugin_admin_scripts' ) ); 269 add_action( 'admin_print_scripts', array( __CLASS__, 'plugin_editor_scripts' ) ); 270 /** 271 * Use the admin_print_styles action to add CSS. 272 * CSS is needed for the post/page editor only 273 */ 274 add_action( 'admin_print_styles', array( __CLASS__, 'plugin_admin_styles' ) ); 263 add_submenu_page( 'options-general.php', __( 'Rich Text Excerpts', 'rich-text-excerpts' ), __( 'Rich Text Excerpts', 'rich-text-excerpts' ), "manage_options", "rich_text_excerpts_options", array( __CLASS__, "plugin_options_page" ) ); 275 264 } 276 265 277 266 /** 278 267 * add script to admin for plugin options 279 */ 280 public static function plugin_admin_scripts() 281 { 282 wp_enqueue_script('RichTextExcerptsAdminScript', plugins_url('rich-text-excerpts.js', __FILE__), array('jquery')); 283 } 284 285 /** 286 * add script to admin for plugin options 287 */ 288 public static function plugin_editor_scripts() 289 { 268 * called using admin_enqueue_scripts hook 269 */ 270 public static function add_plugin_scripts_styles( $hook ) 271 { 272 /** 273 * check $hook to queue script for options page 274 */ 275 if ( $hook === 'settings_page_rich_text_excerpts_options' ) { 276 wp_enqueue_script( 277 'RichTextExcerptsAdminScript', 278 plugins_url('rich-text-excerpts.js', __FILE__), 279 array('jquery') 280 ); 281 } 282 /** 283 * check post type to queue script and style for editor 284 */ 290 285 $screen = get_current_screen(); 291 286 if ( self::post_type_supported( $screen->post_type ) ) { 292 wp_enqueue_script('RichTextExcerptsEditorScript', plugins_url('rich-text-excerpts-editor.js', __FILE__), array('jquery')); 293 } 294 } 295 296 /** 297 * add css to admin for editor formatting 298 */ 299 public static function plugin_admin_styles() 300 { 301 $screen = get_current_screen(); 302 if ( self::post_type_supported( $screen->post_type ) ) { 303 wp_enqueue_style('RichTextExcerptsAdminCSS', plugins_url('rich-text-excerpts.css', __FILE__)); 304 } 305 } 306 287 wp_enqueue_script( 288 'RichTextExcerptsEditorScript', 289 plugins_url('rich-text-excerpts-editor.js', __FILE__), 290 array('jquery') 291 ); 292 wp_enqueue_style( 293 'RichTextExcerptsAdminCSS', 294 plugins_url('rich-text-excerpts.css', __FILE__) 295 ); 296 } 297 } 298 307 299 /** 308 300 * creates the options page … … 310 302 public static function plugin_options_page() 311 303 { 312 printf('<div class="wrap">< div class="icon32" id="icon-options-general"><br /></div><h2>%s</h2>', __('Rich Text Excerpts Options', 'rich-text-excerpts'));304 printf('<div class="wrap"><h2>%s</h2>', __('Rich Text Excerpts Options', 'rich-text-excerpts')); 313 305 settings_errors('rich_text_excerpts_options'); 314 306 print('<form method="post" action="options.php" id="rich_text_excerpts_options_form">'); 315 307 settings_fields('rich_text_excerpts_options'); 316 308 do_settings_sections('rte'); 317 printf('<p class="submit"><input type="submit" class="button-primary" name="Submit" value="%s" /></p>', __('Save Changes', 'rich-text-excerpts'));309 submit_button(); 318 310 print('</form></div>'); 319 311 }
Note: See TracChangeset
for help on using the changeset viewer.