Genesis Simple Hooks - Version 1.6

Version Description

  • Increased requirement to Genesis 1.6
  • Fixed bug with things not unhooking
Download this release

Release Info

Developer nathanrice
Plugin Icon 128x128 Genesis Simple Hooks
Version 1.6
Comparing to
See all releases

Code changes from version 1.4 to 1.6

Files changed (2) hide show
  1. plugin.php +29 -29
  2. readme.txt +8 -4
plugin.php CHANGED
@@ -3,39 +3,39 @@
3
  Plugin Name: Genesis Simple Hooks
4
  Plugin URI: http://www.studiopress.com/plugins/simple-hooks
5
  Description: Genesis Simple Hooks allows you easy access to the 50+ Action Hooks in the Genesis Theme.
6
- Version: 1.4
7
  Author: Nathan Rice
8
  Author URI: http://www.nathanrice.net/
9
  */
10
 
11
- // require Genesis 1.4 upon activation
12
- register_activation_hook(__FILE__, 'simplehooks_activation_check');
13
  function simplehooks_activation_check() {
14
 
15
- $latest = '1.4';
16
 
17
- $theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
18
 
19
- if( basename(TEMPLATEPATH) != 'genesis' ) {
20
- deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
21
- wp_die('Sorry, you can\'t activate unless you have installed <a href="http://www.studiopress.com/themes/genesis">Genesis</a>');
22
  }
23
 
24
- if( version_compare( $theme_info['Version'], $latest, '<' ) ) {
25
- deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
26
- wp_die('Sorry, you can\'t activate without <a href="http://www.studiopress.com/support/showthread.php?t=19576">Genesis '.$latest.'</a> or greater');
27
  }
28
 
29
  }
30
 
31
  // Define our constants
32
- define('SIMPLEHOOKS_SETTINGS_FIELD', 'simplehooks-settings');
33
- define('SIMPLEHOOKS_PLUGIN_DIR', dirname(__FILE__));
34
 
35
  // Include files
36
- require_once(SIMPLEHOOKS_PLUGIN_DIR . '/admin.php');
37
- require_once(SIMPLEHOOKS_PLUGIN_DIR . '/functions.php');
38
- require_once(SIMPLEHOOKS_PLUGIN_DIR . '/boxes.php');
39
 
40
  /**
41
  * The following code loops through all the hooks, and attempts to
@@ -43,24 +43,24 @@ require_once(SIMPLEHOOKS_PLUGIN_DIR . '/boxes.php');
43
  *
44
  * @since 0.1
45
  */
46
- add_action('genesis_init', 'simplehooks_execute_hooks');
47
  function simplehooks_execute_hooks() {
48
 
49
- $hooks = get_option(SIMPLEHOOKS_SETTINGS_FIELD);
50
 
51
- foreach( (array)$hooks as $hook => $array ) {
52
 
53
  // Add new content to hook
54
- if( simplehooks_get_option($hook, 'content') ) {
55
- add_action($hook, 'simplehooks_execute_hook');
56
  }
57
 
58
  // Unhook stuff
59
  if( isset( $array['unhook'] ) ) {
60
 
61
- foreach( (array)$array['unhook'] as $function ) {
62
 
63
- remove_action($hook, $function);
64
 
65
  }
66
 
@@ -79,16 +79,16 @@ function simplehooks_execute_hooks() {
79
  function simplehooks_execute_hook() {
80
 
81
  $hook = current_filter();
82
- $content = simplehooks_get_option($hook, 'content');
83
 
84
- if( !$hook || !$content ) return;
85
 
86
- $shortcodes = simplehooks_get_option($hook, 'shortcodes');
87
- $php = simplehooks_get_option($hook, 'php');
88
 
89
- $value = $shortcodes ? do_shortcode($content) : $content;
90
 
91
- if( $php )
92
  eval( "?>$value<?php " );
93
  else
94
  echo $value;
3
  Plugin Name: Genesis Simple Hooks
4
  Plugin URI: http://www.studiopress.com/plugins/simple-hooks
5
  Description: Genesis Simple Hooks allows you easy access to the 50+ Action Hooks in the Genesis Theme.
6
+ Version: 1.6
7
  Author: Nathan Rice
8
  Author URI: http://www.nathanrice.net/
9
  */
10
 
11
+ // require Genesis 1.6 upon activation
12
+ register_activation_hook( __FILE__, 'simplehooks_activation_check' );
13
  function simplehooks_activation_check() {
14
 
15
+ $latest = '1.6';
16
 
17
+ $theme_info = get_theme_data( TEMPLATEPATH.'/style.css' );
18
 
19
+ if ( basename( TEMPLATEPATH ) != 'genesis' ) {
20
+ deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate ourself
21
+ wp_die( 'Sorry, you can\'t activate unless you have installed <a href="http://www.studiopress.com/themes/genesis">Genesis</a>' );
22
  }
23
 
24
+ if ( version_compare( $theme_info['Version'], $latest, '<' ) ) {
25
+ deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate ourself
26
+ wp_die( 'Sorry, you can\'t activate without <a href="http://www.studiopress.com/support/showthread.php?t=19576">Genesis '.$latest.'</a> or greater' );
27
  }
28
 
29
  }
30
 
31
  // Define our constants
32
+ define( 'SIMPLEHOOKS_SETTINGS_FIELD', 'simplehooks-settings' );
33
+ define( 'SIMPLEHOOKS_PLUGIN_DIR', dirname( __FILE__ ) );
34
 
35
  // Include files
36
+ require_once( SIMPLEHOOKS_PLUGIN_DIR . '/admin.php' );
37
+ require_once( SIMPLEHOOKS_PLUGIN_DIR . '/functions.php' );
38
+ require_once( SIMPLEHOOKS_PLUGIN_DIR . '/boxes.php' );
39
 
40
  /**
41
  * The following code loops through all the hooks, and attempts to
43
  *
44
  * @since 0.1
45
  */
46
+ add_action( 'genesis_init', 'simplehooks_execute_hooks', 20 );
47
  function simplehooks_execute_hooks() {
48
 
49
+ $hooks = get_option( SIMPLEHOOKS_SETTINGS_FIELD );
50
 
51
+ foreach( (array) $hooks as $hook => $array ) {
52
 
53
  // Add new content to hook
54
+ if( simplehooks_get_option( $hook, 'content' ) ) {
55
+ add_action( $hook, 'simplehooks_execute_hook' );
56
  }
57
 
58
  // Unhook stuff
59
  if( isset( $array['unhook'] ) ) {
60
 
61
+ foreach( (array) $array['unhook'] as $function ) {
62
 
63
+ remove_action( $hook, $function );
64
 
65
  }
66
 
79
  function simplehooks_execute_hook() {
80
 
81
  $hook = current_filter();
82
+ $content = simplehooks_get_option( $hook, 'content' );
83
 
84
+ if( ! $hook || ! $content ) return;
85
 
86
+ $shortcodes = simplehooks_get_option( $hook, 'shortcodes' );
87
+ $php = simplehooks_get_option( $hook, 'php' );
88
 
89
+ $value = $shortcodes ? do_shortcode( $content ) : $content;
90
 
91
+ if ( $php )
92
  eval( "?>$value<?php " );
93
  else
94
  echo $value;
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: nathanrice, studiopress
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: hooks, genesis, genesiswp, studiopress
5
- Requires at least: 3.0
6
- Tested up to: 3.0.2
7
- Stable tag: 1.4
8
 
9
  This plugin creates a new Genesis settings page that allows you to insert code (HTML, Shortcodes, and PHP), and attach it to any of the 50+ action hooks throughout the Genesis Theme Framework, from StudioPress.
10
 
@@ -97,4 +97,8 @@ The most common request from Genesis users is how to properly modify their foote
97
 
98
  = 1.4 =
99
  * Increased requirement to Genesis 1.4
100
- * Fixed undefined index but in functions.php
 
 
 
 
2
  Contributors: nathanrice, studiopress
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: hooks, genesis, genesiswp, studiopress
5
+ Requires at least: 3.1
6
+ Tested up to: 3.1.1
7
+ Stable tag: 1.6
8
 
9
  This plugin creates a new Genesis settings page that allows you to insert code (HTML, Shortcodes, and PHP), and attach it to any of the 50+ action hooks throughout the Genesis Theme Framework, from StudioPress.
10
 
97
 
98
  = 1.4 =
99
  * Increased requirement to Genesis 1.4
100
+ * Fixed undefined index bug in functions.php
101
+
102
+ = 1.6 =
103
+ * Increased requirement to Genesis 1.6
104
+ * Fixed bug with things not unhooking