Rich Text Excerpts - Version 1.3.4

Version Description

  • started using admin_enqueue_scripts to enqueue all scripts and styles.
  • Added icon
  • Bumped "Tested up to" value to 4.9.4
Download this release

Release Info

Developer bjorsq
Plugin Icon 128x128 Rich Text Excerpts
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

Files changed (2) hide show
  1. readme.txt +7 -2
  2. rich-text-excerpts.php +30 -38
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: bjorsq
3
  Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QAQ2WC8UHFMEQ
4
  Tags: excerpt, editor, TinyMCE, formatting
5
  Requires at least: 3.3
6
- Tested up to: 4.6
7
- Stable tag: 1.3.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -76,6 +76,11 @@ Other plugins which enhance the excerpt editor in some way will probably have is
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
79
  = 1.3.3 =
80
  * Incorporated *some* of the suggestions in [this forum post](https://wordpress.org/support/topic/css-to-remove-space) about the padding around the editor
81
  * Bumped "Tested up to" value to Wordpress 4.4.
3
  Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QAQ2WC8UHFMEQ
4
  Tags: excerpt, editor, TinyMCE, formatting
5
  Requires at least: 3.3
6
+ Tested up to: 4.9.4
7
+ Stable tag: 1.3.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
76
 
77
  == Changelog ==
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
+
84
  = 1.3.3 =
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
86
  * Bumped "Tested up to" value to Wordpress 4.4.
rich-text-excerpts.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/extend/plugins/rich-text-excerpts/
5
  Description: Adds rich text editing capability for excerpts using wp_editor()
6
  Author: Peter Edwards <pete@bjorsq.net>
7
  Author URI: https://github.com/bjorsq/rich-text-excerpts
8
- Version: 1.3.3
9
  Text Domain: rich-text-excerpts
10
  License: GPLv3
11
 
@@ -63,10 +63,11 @@ class Rich_Text_Excerpts {
63
  add_filter( 'teeny_mce_plugins', array( __CLASS__, 'teeny_mce_plugins' ), 10, 2 );
64
  add_filter( 'teeny_mce_buttons', array( __CLASS__, 'teeny_mce_buttons' ), 10, 2 );
65
  /**
66
- * register plugin admin options
67
  */
68
  add_action( 'admin_menu', array( __CLASS__, 'add_plugin_admin_menu' ) );
69
  add_action( 'admin_init', array( __CLASS__, 'register_plugin_options' ) );
 
70
 
71
  /**
72
  * add a link to the settings page from the plugins page
@@ -259,62 +260,53 @@ class Rich_Text_Excerpts {
259
  public static function add_plugin_admin_menu()
260
  {
261
  /* 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' ) );
275
  }
276
 
277
  /**
278
  * 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
- {
290
- $screen = get_current_screen();
291
- 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
-
307
  /**
308
  * creates the options page
309
  */
310
  public static function plugin_options_page()
311
  {
312
- printf('<div class="wrap"><div class="icon32" id="icon-options-general"><br /></div><h2>%s</h2>', __('Rich Text Excerpts Options', 'rich-text-excerpts'));
313
  settings_errors('rich_text_excerpts_options');
314
  print('<form method="post" action="options.php" id="rich_text_excerpts_options_form">');
315
  settings_fields('rich_text_excerpts_options');
316
  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'));
318
  print('</form></div>');
319
  }
320
 
5
  Description: Adds rich text editing capability for excerpts using wp_editor()
6
  Author: Peter Edwards <pete@bjorsq.net>
7
  Author URI: https://github.com/bjorsq/rich-text-excerpts
8
+ Version: 1.3.4
9
  Text Domain: rich-text-excerpts
10
  License: GPLv3
11
 
63
  add_filter( 'teeny_mce_plugins', array( __CLASS__, 'teeny_mce_plugins' ), 10, 2 );
64
  add_filter( 'teeny_mce_buttons', array( __CLASS__, 'teeny_mce_buttons' ), 10, 2 );
65
  /**
66
+ * create admin page, register plugin admin options and enqueue scripts/CSS
67
  */
68
  add_action( 'admin_menu', array( __CLASS__, 'add_plugin_admin_menu' ) );
69
  add_action( 'admin_init', array( __CLASS__, 'register_plugin_options' ) );
70
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_plugin_scripts_styles' ) );
71
 
72
  /**
73
  * add a link to the settings page from the plugins page
260
  public static function add_plugin_admin_menu()
261
  {
262
  /* Plugin Options page */
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" ) );
 
 
 
 
 
 
 
 
 
 
 
 
264
  }
265
 
266
  /**
267
  * add script to admin for plugin options
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
+ */
 
 
 
 
285
  $screen = get_current_screen();
286
  if ( self::post_type_supported( $screen->post_type ) ) {
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
+
299
  /**
300
  * creates the options page
301
  */
302
  public static function plugin_options_page()
303
  {
304
+ printf('<div class="wrap"><h2>%s</h2>', __('Rich Text Excerpts Options', 'rich-text-excerpts'));
305
  settings_errors('rich_text_excerpts_options');
306
  print('<form method="post" action="options.php" id="rich_text_excerpts_options_form">');
307
  settings_fields('rich_text_excerpts_options');
308
  do_settings_sections('rte');
309
+ submit_button();
310
  print('</form></div>');
311
  }
312