Genesis Simple Edits - Version 1.7.1

Version Description

  • Increased installation requirement to Genesis 1.7.1
  • Removed PHP4 constructor
  • Whitespace, standards, and documentation
Download this release

Release Info

Developer wpmuguru
Plugin Icon 128x128 Genesis Simple Edits
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.0 to 1.7.1

Files changed (2) hide show
  1. plugin.php +54 -47
  2. readme.txt +10 -5
plugin.php CHANGED
@@ -1,62 +1,67 @@
1
  <?php
2
  /*
3
- Plugin Name: Genesis Simple Edits
4
- Plugin URI: http://www.studiopress.com/plugins/genesis-simple-edits
5
- Description: Genesis Simple Edits lets you edit the three most commonly modified areas in any Genesis theme: the post-info, the post-meta, and the footer area.
6
- Version: 1.0
7
- Author: Nathan Rice
8
- Author URI: http://www.nathanrice.net/
 
 
 
 
9
  */
10
 
 
 
 
 
 
 
11
  class Genesis_Simple_Edits {
12
 
13
- // Constructor
14
  function __construct() {
15
 
16
- register_activation_hook( __FILE__, array( &$this, 'activation_hook' ) );
17
 
18
  define( 'GSE_SETTINGS_FIELD', 'gse-settings' );
19
 
20
- add_action( 'admin_init', array( &$this, 'javascript' ) );
21
- add_action( 'admin_init', array( &$this, 'reset' ) );
22
- add_action( 'admin_init', array( &$this, 'register_settings' ) );
23
- add_action( 'admin_menu', array( &$this, 'add_menu' ), 15 );
24
- add_action( 'admin_notices', array( &$this, 'notices' ) );
25
 
26
- add_filter( 'genesis_post_info', array( &$this, 'post_info_filter' ), 20 );
27
- add_filter( 'genesis_post_meta', array( &$this, 'post_meta_filter' ), 20 );
28
- add_filter( 'genesis_footer_backtotop_text', array( &$this, 'footer_backtotop_filter' ), 20 );
29
- add_filter( 'genesis_footer_creds_text', array( &$this, 'footer_creds_filter' ), 20 );
30
- add_filter( 'genesis_footer_output', array( &$this, 'footer_output_filter' ), 20 );
31
-
32
- }
33
 
34
- // PHP4 Constructor
35
- function Genesis_Simple_Edits() {
36
- $this->__construct();
37
  }
38
 
39
  function activation_hook() {
40
 
41
- $latest = '1.3';
42
-
43
- $theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
44
-
45
- if( basename(TEMPLATEPATH) != 'genesis' ) {
46
- deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
47
- wp_die('Sorry, you can\'t activate unless you have installed <a href="http://www.studiopress.com/themes/genesis">Genesis</a>');
48
  }
49
 
50
  if ( version_compare( $theme_info['Version'], $latest, '<' ) ) {
51
- deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
52
- wp_die('Sorry, you can\'t activate without <a href="http://www.studiopress.com/support/showthread.php?t=19576">Genesis '.$latest.'</a> or greater');
53
- }
54
 
55
  }
56
 
57
  function javascript() {
58
 
59
- wp_enqueue_script( 'genesis-simple-edits-js', plugin_dir_url(__FILE__) . 'js/admin.js', array('jquery'), '', true );
60
 
61
  }
62
 
@@ -67,10 +72,10 @@ class Genesis_Simple_Edits {
67
 
68
  function reset() {
69
 
70
- if ( !isset($_REQUEST['page']) || $_REQUEST['page'] != 'genesis-simple-edits' )
71
  return;
72
 
73
- if ( genesis_get_option('reset', GSE_SETTINGS_FIELD) ) {
74
  update_option( GSE_SETTINGS_FIELD, $this->settings_defaults() );
75
  wp_redirect( admin_url( 'admin.php?page=genesis-simple-edits&reset=true' ) );
76
  exit;
@@ -80,14 +85,14 @@ class Genesis_Simple_Edits {
80
 
81
  function notices() {
82
 
83
- if ( !isset($_REQUEST['page']) || $_REQUEST['page'] != 'genesis-simple-edits' )
84
  return;
85
 
86
- if ( isset( $_REQUEST['reset'] ) && $_REQUEST['reset'] == 'true' ) {
87
- echo '<div id="message" class="updated"><p><strong>'.__('Simple Edits Reset', 'gse').'</strong></p></div>';
88
  }
89
- elseif ( isset($_REQUEST['updated']) && $_REQUEST['updated'] == 'true') {
90
- echo '<div id="message" class="updated"><p><strong>'.__('Simple Edits Saved', 'gse').'</strong></p></div>';
91
  }
92
 
93
  }
@@ -106,17 +111,19 @@ class Genesis_Simple_Edits {
106
  }
107
 
108
  function add_menu() {
109
- add_submenu_page('genesis', __('Simple Edits','gse'), __('Simple Edits','gse'), 'manage_options', 'genesis-simple-edits', array( &$this, 'admin_page' ) );
 
 
110
  }
111
 
112
  function admin_page() { ?>
113
 
114
  <div class="wrap">
115
  <form method="post" action="options.php">
116
- <?php settings_fields(GSE_SETTINGS_FIELD); // important! ?>
117
 
118
- <?php screen_icon('options-general'); ?>
119
- <h2><?php _e('Genesis Simple Edits', 'gse'); ?></h2>
120
 
121
  <table class="form-table"><tbody>
122
 
@@ -140,7 +147,7 @@ class Genesis_Simple_Edits {
140
  <tr class="post-shortcodes" style="display: none;">
141
  <th scope="row"><p><span class="description"><?php _e('Shortcode Reference'); ?></span></p></th>
142
  <td>
143
- <p><span class="description"><?php _e('NOTE: For a more comprehensive shortcode usage guide, <a href="http://dev.studiopress.com/shortcode-reference" target="_blank">see this page</a>.') ?>
144
  <p>
145
  <ul>
146
  <li>[post_date] - <span class="description"><?php _e('Date the post was published', ''); ?></span></li>
@@ -187,7 +194,7 @@ class Genesis_Simple_Edits {
187
  <tr class="footer-shortcodes" style="display: none;">
188
  <th scope="row"><p><span class="description"><?php _e('Shortcode Reference'); ?></span></p></th>
189
  <td>
190
- <p><span class="description"><?php _e('NOTE: For a more comprehensive shortcode usage guide, <a href="http://dev.studiopress.com/shortcode-reference" target="_blank">see this page</a>.') ?>
191
  <p>
192
  <ul>
193
  <li>[footer_backtotop] - <span class="description"><?php _e('The "Back to Top" Link', ''); ?></span></li>
1
  <?php
2
  /*
3
+ Plugin Name: Genesis Simple Edits
4
+ Plugin URI: http://www.studiopress.com/plugins/genesis-simple-edits
5
+ Description: Genesis Simple Edits lets you edit the three most commonly modified areas in any Genesis theme: the post-info, the post-meta, and the footer area.
6
+ Author: Nathan Rice
7
+ Author URI: http://www.nathanrice.net/
8
+
9
+ Version: 1.7.1
10
+
11
+ License: GNU General Public License v2.0 (or later)
12
+ License URI: http://www.opensource.org/licenses/gpl-license.php
13
  */
14
 
15
+ /**
16
+ * The main class that handles the entire output, content filters, etc., for this plugin.
17
+ *
18
+ * @package Genesis Simple Edits
19
+ * @since 1.0
20
+ */
21
  class Genesis_Simple_Edits {
22
 
23
+ /** Constructor */
24
  function __construct() {
25
 
26
+ register_activation_hook( __FILE__, array( $this, 'activation_hook' ) );
27
 
28
  define( 'GSE_SETTINGS_FIELD', 'gse-settings' );
29
 
30
+ add_action( 'admin_init', array( $this, 'javascript' ) );
31
+ add_action( 'admin_init', array( $this, 'reset' ) );
32
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
33
+ add_action( 'admin_menu', array( $this, 'add_menu' ), 15 );
34
+ add_action( 'admin_notices', array( $this, 'notices' ) );
35
 
36
+ add_filter( 'genesis_post_info', array( $this, 'post_info_filter' ), 20 );
37
+ add_filter( 'genesis_post_meta', array( $this, 'post_meta_filter' ), 20 );
38
+ add_filter( 'genesis_footer_backtotop_text', array( $this, 'footer_backtotop_filter' ), 20 );
39
+ add_filter( 'genesis_footer_creds_text', array( $this, 'footer_creds_filter' ), 20 );
40
+ add_filter( 'genesis_footer_output', array( $this, 'footer_output_filter' ), 20 );
 
 
41
 
 
 
 
42
  }
43
 
44
  function activation_hook() {
45
 
46
+ $latest = '1.7.1';
47
+
48
+ $theme_info = get_theme_data( TEMPLATEPATH . '/style.css' );
49
+
50
+ if ( 'genesis' != basename( TEMPLATEPATH ) ) {
51
+ deactivate_plugins( plugin_basename( __FILE__ ) ); /** Deactivate ourself */
52
+ wp_die( sprintf( __( 'Sorry, you can\'t activate unless you have installed <a href="%s">Genesis</a>', 'apl' ), 'http://www.studiopress.com/themes/genesis' ) );
53
  }
54
 
55
  if ( version_compare( $theme_info['Version'], $latest, '<' ) ) {
56
+ deactivate_plugins( plugin_basename( __FILE__ ) ); /** Deactivate ourself */
57
+ wp_die( sprintf( __( 'Sorry, you cannot activate without <a href="%s">Genesis %s</a> or greater', 'apl' ), 'http://www.studiopress.com/support/showthread.php?t=19576', $latest ) );
58
+ }
59
 
60
  }
61
 
62
  function javascript() {
63
 
64
+ wp_enqueue_script( 'genesis-simple-edits-js', plugin_dir_url(__FILE__) . 'js/admin.js', array( 'jquery' ), '', true );
65
 
66
  }
67
 
72
 
73
  function reset() {
74
 
75
+ if ( ! isset( $_REQUEST['page'] ) || 'genesis-simple-edits' != $_REQUEST['page'] )
76
  return;
77
 
78
+ if ( genesis_get_option( 'reset', GSE_SETTINGS_FIELD ) ) {
79
  update_option( GSE_SETTINGS_FIELD, $this->settings_defaults() );
80
  wp_redirect( admin_url( 'admin.php?page=genesis-simple-edits&reset=true' ) );
81
  exit;
85
 
86
  function notices() {
87
 
88
+ if ( ! isset( $_REQUEST['page'] ) || 'genesis-simple-edits' != $_REQUEST['page'] )
89
  return;
90
 
91
+ if ( isset( $_REQUEST['reset'] ) && 'true' == $_REQUEST['reset'] ) {
92
+ echo '<div id="message" class="updated"><p><strong>' . __( 'Simple Edits Reset', 'gse' ) . '</strong></p></div>';
93
  }
94
+ elseif ( isset( $_REQUEST['updated'] ) && 'true' == $_REQUEST['updated'] ) {
95
+ echo '<div id="message" class="updated"><p><strong>' . __( 'Simple Edits Saved', 'gse' ) . '</strong></p></div>';
96
  }
97
 
98
  }
111
  }
112
 
113
  function add_menu() {
114
+
115
+ add_submenu_page('genesis', __('Genesis - Simple Edits','gse'), __('Simple Edits','gse'), 'manage_options', 'genesis-simple-edits', array( &$this, 'admin_page' ) );
116
+
117
  }
118
 
119
  function admin_page() { ?>
120
 
121
  <div class="wrap">
122
  <form method="post" action="options.php">
123
+ <?php settings_fields( GSE_SETTINGS_FIELD ); // important! ?>
124
 
125
+ <?php screen_icon( 'options-general' ); ?>
126
+ <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
127
 
128
  <table class="form-table"><tbody>
129
 
147
  <tr class="post-shortcodes" style="display: none;">
148
  <th scope="row"><p><span class="description"><?php _e('Shortcode Reference'); ?></span></p></th>
149
  <td>
150
+ <p><span class="description"><?php _e('NOTE: For a more comprehensive shortcode usage guide, <a href="http://my.studiopress.com/docs/shortcode-reference/" target="_blank">see this page</a>.') ?>
151
  <p>
152
  <ul>
153
  <li>[post_date] - <span class="description"><?php _e('Date the post was published', ''); ?></span></li>
194
  <tr class="footer-shortcodes" style="display: none;">
195
  <th scope="row"><p><span class="description"><?php _e('Shortcode Reference'); ?></span></p></th>
196
  <td>
197
+ <p><span class="description"><?php _e('NOTE: For a more comprehensive shortcode usage guide, <a href="http://my.studiopress.com/docs/shortcode-reference/" target="_blank">see this page</a>.') ?>
198
  <p>
199
  <ul>
200
  <li>[footer_backtotop] - <span class="description"><?php _e('The "Back to Top" Link', ''); ?></span></li>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
- Contributors: nathanrice, studiopress
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: shortcodes, genesis, genesiswp, studiopress
5
- Requires at least: 3.0
6
- Tested up to: 3.0.1
7
- Stable tag: 1.0
8
 
9
  This plugin lets you edit the three most commonly modified areas in any Genesis theme: the post-info (byline), the post-meta, and the footer area.
10
 
@@ -38,4 +38,9 @@ You must have Genesis (1.3+) or a Genesis child theme installed and activated on
38
  == Changelog ==
39
 
40
  = 1.0 =
41
- * Initial Release
 
 
 
 
 
1
  === Plugin Name ===
2
+ Contributors: nathanrice, studiopress, wpmuguru
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: shortcodes, genesis, genesiswp, studiopress
5
+ Requires at least: 3.2
6
+ Tested up to: 3.5
7
+ Stable tag: 1.7.1
8
 
9
  This plugin lets you edit the three most commonly modified areas in any Genesis theme: the post-info (byline), the post-meta, and the footer area.
10
 
38
  == Changelog ==
39
 
40
  = 1.0 =
41
+ * Initial Release
42
+
43
+ = 1.7.1 =
44
+ * Increased installation requirement to Genesis 1.7.1
45
+ * Removed PHP4 constructor
46
+ * Whitespace, standards, and documentation