Version Description
- Increased requirement to Genesis 1.7.1
- Fixed display issues in the admin screen
- Added new hooks to the defaults array
- Whitespace, standards, and documentation
Download this release
Release Info
| Developer | nathanrice |
| Plugin | |
| Version | 1.7.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.6 to 1.7.1
- admin.php +166 -144
- boxes.php +264 -264
- functions.php +30 -29
- plugin.php +50 -40
- readme.txt +10 -4
admin.php
CHANGED
|
@@ -5,97 +5,110 @@
|
|
| 5 |
* @since 0.1
|
| 6 |
*/
|
| 7 |
function simplehooks_defaults() {
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
'
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
'
|
| 17 |
-
'
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
'
|
| 25 |
-
'
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
'
|
| 30 |
-
|
| 31 |
-
'
|
| 32 |
-
'
|
| 33 |
-
|
| 34 |
-
'
|
| 35 |
-
'
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
'
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
'
|
| 42 |
-
'
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
'
|
| 46 |
-
|
| 47 |
-
'
|
| 48 |
-
|
| 49 |
-
'
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
'
|
| 55 |
-
|
| 56 |
-
'
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
'
|
| 61 |
-
'
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
'
|
| 67 |
-
'
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
'
|
| 71 |
-
'
|
| 72 |
-
|
| 73 |
-
'
|
| 74 |
-
|
| 75 |
-
'
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
'
|
| 80 |
-
'
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
'
|
| 84 |
-
'
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
'
|
| 89 |
-
'
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
'
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
'
|
| 96 |
-
'
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
);
|
| 100 |
|
| 101 |
}
|
|
@@ -103,60 +116,67 @@ function simplehooks_defaults() {
|
|
| 103 |
/**
|
| 104 |
* This registers the settings field and adds defaults to the options table
|
| 105 |
*/
|
| 106 |
-
add_action('admin_init', 'register_simplehooks_settings');
|
| 107 |
function register_simplehooks_settings() {
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
}
|
| 111 |
|
| 112 |
/**
|
| 113 |
* This is a necessary go-between to get our scripts and boxes loaded
|
| 114 |
* on the theme settings page only, and not the rest of the admin
|
| 115 |
*/
|
| 116 |
-
add_action('admin_menu', 'simplehooks_settings_init', 15);
|
| 117 |
function simplehooks_settings_init() {
|
|
|
|
| 118 |
global $_simplehooks_settings_pagehook;
|
| 119 |
-
|
| 120 |
// Add "Design Settings" submenu
|
| 121 |
-
$_simplehooks_settings_pagehook = add_submenu_page('genesis', __('Simple Hooks','simplehooks'), __('Simple Hooks','simplehooks'), 'manage_options', 'simplehooks', 'simplehooks_settings_admin');
|
| 122 |
-
|
| 123 |
-
add_action('load-'.$_simplehooks_settings_pagehook, 'simplehooks_settings_scripts');
|
| 124 |
-
add_action('load-'.$_simplehooks_settings_pagehook, 'simplehooks_settings_boxes');
|
|
|
|
| 125 |
}
|
| 126 |
|
| 127 |
-
function simplehooks_settings_scripts() {
|
| 128 |
-
wp_enqueue_script('common');
|
| 129 |
-
wp_enqueue_script('wp-lists');
|
| 130 |
-
wp_enqueue_script('postbox');
|
| 131 |
}
|
| 132 |
|
| 133 |
function simplehooks_settings_boxes() {
|
| 134 |
global $_simplehooks_settings_pagehook;
|
| 135 |
-
|
| 136 |
-
add_meta_box('simplehooks-wp-hooks', __('WordPress Hooks', 'simplehooks'), 'simplehooks_wp_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 137 |
-
add_meta_box('simplehooks-document-hooks', __('Document Hooks', 'simplehooks'), 'simplehooks_document_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 138 |
-
add_meta_box('simplehooks-header-hooks', __('Header Hooks', 'simplehooks'), 'simplehooks_header_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 139 |
-
add_meta_box('simplehooks-content-hooks', __('Content Hooks', 'simplehooks'), 'simplehooks_content_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 140 |
-
add_meta_box('simplehooks-loop-hooks', __('Loop Hooks', 'simplehooks'), 'simplehooks_loop_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 141 |
-
add_meta_box('simplehooks-post-hooks', __('Post/Page Hooks', 'simplehooks'), 'simplehooks_post_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 142 |
-
add_meta_box('simplehooks-comment-list-hooks', __('Comment List Hooks', 'simplehooks'), 'simplehooks_comment_list_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 143 |
-
add_meta_box('simplehooks-ping-list-hooks', __('Ping List Hooks', 'simplehooks'), 'simplehooks_ping_list_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 144 |
-
add_meta_box('simplehooks-comment-hooks', __('Single Comment Hooks', 'simplehooks'), 'simplehooks_comment_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 145 |
-
add_meta_box('simplehooks-comment-form-hooks', __('Comment Form Hooks', 'simplehooks'), 'simplehooks_comment_form_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 146 |
-
add_meta_box('simplehooks-sidebar-hooks', __('Sidebar Hooks', 'simplehooks'), 'simplehooks_sidebar_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 147 |
-
add_meta_box('simplehooks-footer-hooks', __('Footer Hooks', 'simplehooks'), 'simplehooks_footer_hooks_box', $_simplehooks_settings_pagehook, 'column1');
|
| 148 |
}
|
| 149 |
|
| 150 |
/**
|
| 151 |
* Tell WordPress that we want only 1 column available for our meta-boxes
|
| 152 |
*/
|
| 153 |
-
add_filter('screen_layout_columns', 'simplehooks_settings_layout_columns', 10, 2);
|
| 154 |
-
function simplehooks_settings_layout_columns($columns, $screen) {
|
|
|
|
| 155 |
global $_simplehooks_settings_pagehook;
|
| 156 |
-
|
|
|
|
| 157 |
// This page should have 3 column options
|
| 158 |
$columns[$_simplehooks_settings_pagehook] = 1;
|
| 159 |
}
|
|
|
|
| 160 |
return $columns;
|
| 161 |
}
|
| 162 |
|
|
@@ -164,49 +184,51 @@ function simplehooks_settings_layout_columns($columns, $screen) {
|
|
| 164 |
* This function is what actually gets output to the page. It handles the markup,
|
| 165 |
* builds the form, outputs necessary JS stuff, and fires <code>do_meta_boxes()</code>
|
| 166 |
*/
|
| 167 |
-
function simplehooks_settings_admin() {
|
| 168 |
-
|
|
|
|
| 169 |
|
| 170 |
$width = "width: 99%;";
|
| 171 |
$hide2 = $hide3 = " display: none;";
|
| 172 |
-
|
| 173 |
-
?>
|
| 174 |
<div id="simplehooks" class="wrap genesis-metaboxes">
|
| 175 |
<form method="post" action="options.php">
|
| 176 |
-
|
| 177 |
-
<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
| 178 |
-
<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
|
| 179 |
-
<?php settings_fields(SIMPLEHOOKS_SETTINGS_FIELD); // important! ?>
|
| 180 |
-
|
| 181 |
-
<?php screen_icon('plugins'); ?>
|
| 182 |
<h2>
|
| 183 |
-
<?php
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
|
|
|
| 187 |
</h2>
|
| 188 |
-
|
| 189 |
<?php
|
| 190 |
-
if(genesis_get_option('reset', SIMPLEHOOKS_SETTINGS_FIELD)) {
|
| 191 |
-
update_option(SIMPLEHOOKS_SETTINGS_FIELD, simplehooks_defaults());
|
| 192 |
-
echo '<div id="message" class="updated" id="message"><p><strong>'.__('Modifications Reset', 'simplehooks').'</strong></p></div>';
|
| 193 |
}
|
| 194 |
-
elseif( isset($_REQUEST['updated']) && $_REQUEST['updated'] == 'true') {
|
| 195 |
-
echo '<div id="message" class="updated" id="message"><p><strong>'.__('Modifications Saved', 'simplehooks').'</strong></p></div>';
|
| 196 |
}
|
| 197 |
?>
|
| 198 |
-
|
| 199 |
<div class="metabox-holder">
|
| 200 |
<div class="postbox-container" style="<?php echo $width; ?>">
|
| 201 |
-
<?php do_meta_boxes($_simplehooks_settings_pagehook, 'column1', null); ?>
|
| 202 |
</div>
|
| 203 |
</div>
|
| 204 |
-
|
| 205 |
</form>
|
| 206 |
</div>
|
| 207 |
<script type="text/javascript">
|
| 208 |
//<![CDATA[
|
| 209 |
-
jQuery(document).ready(
|
| 210 |
// close postboxes that should be closed
|
| 211 |
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
| 212 |
// postboxes setup
|
| 5 |
* @since 0.1
|
| 6 |
*/
|
| 7 |
function simplehooks_defaults() {
|
| 8 |
+
|
| 9 |
+
return array(
|
| 10 |
+
|
| 11 |
+
/** Wordpress Hooks */
|
| 12 |
+
'wp_head' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 13 |
+
'wp_footer' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 14 |
+
|
| 15 |
+
/** Internal Hooks */
|
| 16 |
+
'genesis_pre' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 17 |
+
'genesis_pre_framework' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 18 |
+
'genesis_init' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 19 |
+
'genesis_setup' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 20 |
+
|
| 21 |
+
/** Document Hooks */
|
| 22 |
+
'genesis_doctype' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 23 |
+
'genesis_title' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 24 |
+
'genesis_meta' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 25 |
+
'genesis_before' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 26 |
+
'genesis_after' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 27 |
+
|
| 28 |
+
/** Header hooks */
|
| 29 |
+
'genesis_before_header' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 30 |
+
'genesis_header' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 31 |
+
'genesis_header_right' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 32 |
+
'genesis_after_header' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 33 |
+
|
| 34 |
+
'genesis_site_title' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 35 |
+
'genesis_site_description' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 36 |
+
|
| 37 |
+
/** Content Hooks */
|
| 38 |
+
'genesis_before_content_sidebar_wrap' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 39 |
+
'genesis_after_content_sidebar_wrap' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 40 |
+
|
| 41 |
+
'genesis_before_content' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 42 |
+
'genesis_after_content' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 43 |
+
|
| 44 |
+
/** Loop Hooks */
|
| 45 |
+
'genesis_before_loop' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 46 |
+
'genesis_loop' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 47 |
+
'genesis_after_loop' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 48 |
+
|
| 49 |
+
'genesis_after_endwhile' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 50 |
+
'genesis_loop_else' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 51 |
+
|
| 52 |
+
/** Post Hooks */
|
| 53 |
+
'genesis_before_post' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 54 |
+
'genesis_after_post' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 55 |
+
|
| 56 |
+
'genesis_before_post_title' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 57 |
+
'genesis_post_title' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 58 |
+
'genesis_after_post_title' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 59 |
+
|
| 60 |
+
'genesis_before_post_content' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 61 |
+
'genesis_post_content' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 62 |
+
'genesis_after_post_content' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 63 |
+
|
| 64 |
+
/** Comment Hooks */
|
| 65 |
+
'genesis_before_comments' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 66 |
+
'genesis_comments' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 67 |
+
'genesis_list_comments' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 68 |
+
'genesis_after_comments' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 69 |
+
|
| 70 |
+
'genesis_before_pings' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 71 |
+
'genesis_pings' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 72 |
+
'genesis_list_pings' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 73 |
+
'genesis_after_pings' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 74 |
+
|
| 75 |
+
'genesis_before_comment' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 76 |
+
'genesis_comment' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 77 |
+
'genesis_after_comment' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 78 |
+
|
| 79 |
+
'genesis_before_comment' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 80 |
+
'genesis_after_comment' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 81 |
+
|
| 82 |
+
'genesis_before_comment_form' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 83 |
+
'genesis_comment_form' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 84 |
+
'genesis_after_comment_form' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 85 |
+
|
| 86 |
+
/** Sidebar Hooks */
|
| 87 |
+
'genesis_before_sidebar' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 88 |
+
'genesis_sidebar' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 89 |
+
'genesis_after_sidebar' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 90 |
+
|
| 91 |
+
'genesis_before_sidebar_widget_area' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 92 |
+
'genesis_after_sidebar_widget_area' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 93 |
+
|
| 94 |
+
'genesis_before_sidebar_alt' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 95 |
+
'genesis_sidebar_alt' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 96 |
+
'genesis_after_sidebar_alt' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 97 |
+
|
| 98 |
+
'genesis_before_sidebar_alt_widget_area' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 99 |
+
'genesis_after_sidebar_alt_widget_area' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 100 |
+
|
| 101 |
+
'genesis_before_footer' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 102 |
+
'genesis_footer' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 103 |
+
'genesis_after_footer' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 104 |
+
|
| 105 |
+
/** Admin Hooks */
|
| 106 |
+
'genesis_import_export_form' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 107 |
+
'genesis_export' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 108 |
+
'genesis_import' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 109 |
+
'genesis_theme_settings_metaboxes' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 110 |
+
'genesis_upgrade' => array( 'content' => '', 'php' => 0, 'shortcodes' => 0 ),
|
| 111 |
+
|
| 112 |
);
|
| 113 |
|
| 114 |
}
|
| 116 |
/**
|
| 117 |
* This registers the settings field and adds defaults to the options table
|
| 118 |
*/
|
| 119 |
+
add_action( 'admin_init', 'register_simplehooks_settings' );
|
| 120 |
function register_simplehooks_settings() {
|
| 121 |
+
|
| 122 |
+
register_setting( SIMPLEHOOKS_SETTINGS_FIELD, SIMPLEHOOKS_SETTINGS_FIELD );
|
| 123 |
+
add_option( SIMPLEHOOKS_SETTINGS_FIELD, simplehooks_defaults(), '', 'yes' );
|
| 124 |
+
|
| 125 |
}
|
| 126 |
|
| 127 |
/**
|
| 128 |
* This is a necessary go-between to get our scripts and boxes loaded
|
| 129 |
* on the theme settings page only, and not the rest of the admin
|
| 130 |
*/
|
| 131 |
+
add_action( 'admin_menu', 'simplehooks_settings_init', 15 );
|
| 132 |
function simplehooks_settings_init() {
|
| 133 |
+
|
| 134 |
global $_simplehooks_settings_pagehook;
|
| 135 |
+
|
| 136 |
// Add "Design Settings" submenu
|
| 137 |
+
$_simplehooks_settings_pagehook = add_submenu_page( 'genesis', __( 'Genesis - Simple Hooks','simplehooks' ), __( 'Simple Hooks','simplehooks' ), 'manage_options', 'simplehooks', 'simplehooks_settings_admin' );
|
| 138 |
+
|
| 139 |
+
add_action( 'load-'.$_simplehooks_settings_pagehook, 'simplehooks_settings_scripts' );
|
| 140 |
+
add_action( 'load-'.$_simplehooks_settings_pagehook, 'simplehooks_settings_boxes' );
|
| 141 |
+
|
| 142 |
}
|
| 143 |
|
| 144 |
+
function simplehooks_settings_scripts() {
|
| 145 |
+
wp_enqueue_script( 'common' );
|
| 146 |
+
wp_enqueue_script( 'wp-lists' );
|
| 147 |
+
wp_enqueue_script( 'postbox' );
|
| 148 |
}
|
| 149 |
|
| 150 |
function simplehooks_settings_boxes() {
|
| 151 |
global $_simplehooks_settings_pagehook;
|
| 152 |
+
|
| 153 |
+
add_meta_box( 'simplehooks-wp-hooks', __( 'WordPress Hooks', 'simplehooks' ), 'simplehooks_wp_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 154 |
+
add_meta_box( 'simplehooks-document-hooks', __( 'Document Hooks', 'simplehooks' ), 'simplehooks_document_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 155 |
+
add_meta_box( 'simplehooks-header-hooks', __( 'Header Hooks', 'simplehooks' ), 'simplehooks_header_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 156 |
+
add_meta_box( 'simplehooks-content-hooks', __( 'Content Hooks', 'simplehooks' ), 'simplehooks_content_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 157 |
+
add_meta_box( 'simplehooks-loop-hooks', __( 'Loop Hooks', 'simplehooks' ), 'simplehooks_loop_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 158 |
+
add_meta_box( 'simplehooks-post-hooks', __( 'Post/Page Hooks', 'simplehooks' ), 'simplehooks_post_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 159 |
+
add_meta_box( 'simplehooks-comment-list-hooks', __( 'Comment List Hooks', 'simplehooks' ), 'simplehooks_comment_list_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 160 |
+
add_meta_box( 'simplehooks-ping-list-hooks', __( 'Ping List Hooks', 'simplehooks' ), 'simplehooks_ping_list_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 161 |
+
add_meta_box( 'simplehooks-comment-hooks', __( 'Single Comment Hooks', 'simplehooks' ), 'simplehooks_comment_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 162 |
+
add_meta_box( 'simplehooks-comment-form-hooks', __( 'Comment Form Hooks', 'simplehooks' ), 'simplehooks_comment_form_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 163 |
+
add_meta_box( 'simplehooks-sidebar-hooks', __( 'Sidebar Hooks', 'simplehooks' ), 'simplehooks_sidebar_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 164 |
+
add_meta_box( 'simplehooks-footer-hooks', __( 'Footer Hooks', 'simplehooks' ), 'simplehooks_footer_hooks_box', $_simplehooks_settings_pagehook, 'column1' );
|
| 165 |
}
|
| 166 |
|
| 167 |
/**
|
| 168 |
* Tell WordPress that we want only 1 column available for our meta-boxes
|
| 169 |
*/
|
| 170 |
+
add_filter( 'screen_layout_columns', 'simplehooks_settings_layout_columns', 10, 2 );
|
| 171 |
+
function simplehooks_settings_layout_columns( $columns, $screen ) {
|
| 172 |
+
|
| 173 |
global $_simplehooks_settings_pagehook;
|
| 174 |
+
|
| 175 |
+
if ( $screen == $_simplehooks_settings_pagehook ) {
|
| 176 |
// This page should have 3 column options
|
| 177 |
$columns[$_simplehooks_settings_pagehook] = 1;
|
| 178 |
}
|
| 179 |
+
|
| 180 |
return $columns;
|
| 181 |
}
|
| 182 |
|
| 184 |
* This function is what actually gets output to the page. It handles the markup,
|
| 185 |
* builds the form, outputs necessary JS stuff, and fires <code>do_meta_boxes()</code>
|
| 186 |
*/
|
| 187 |
+
function simplehooks_settings_admin() {
|
| 188 |
+
|
| 189 |
+
global $_simplehooks_settings_pagehook, $screen_layout_columns;
|
| 190 |
|
| 191 |
$width = "width: 99%;";
|
| 192 |
$hide2 = $hide3 = " display: none;";
|
| 193 |
+
|
| 194 |
+
?>
|
| 195 |
<div id="simplehooks" class="wrap genesis-metaboxes">
|
| 196 |
<form method="post" action="options.php">
|
| 197 |
+
|
| 198 |
+
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
| 199 |
+
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
|
| 200 |
+
<?php settings_fields( SIMPLEHOOKS_SETTINGS_FIELD ); // important! ?>
|
| 201 |
+
|
| 202 |
+
<?php screen_icon( 'plugins' ); ?>
|
| 203 |
<h2>
|
| 204 |
+
<?php
|
| 205 |
+
echo esc_html( get_admin_page_title() );
|
| 206 |
+
submit_button( __( 'Save Settings', 'genesis' ), 'button-primary genesis-h2-button', 'submit', false );
|
| 207 |
+
submit_button( __( 'Reset Settings', 'genesis' ), 'button-secondary genesis-h2-button', SIMPLEHOOKS_SETTINGS_FIELD . '[reset]', false, array( 'onclick' => 'return genesis_confirm(\'' . esc_js( __( 'Are you sure you want to reset?', 'genesis' ) ) . '\');' ) );
|
| 208 |
+
?>
|
| 209 |
</h2>
|
| 210 |
+
|
| 211 |
<?php
|
| 212 |
+
if ( genesis_get_option( 'reset', SIMPLEHOOKS_SETTINGS_FIELD ) ) {
|
| 213 |
+
update_option( SIMPLEHOOKS_SETTINGS_FIELD, simplehooks_defaults() );
|
| 214 |
+
echo '<div id="message" class="updated" id="message"><p><strong>' . __( 'Modifications Reset', 'simplehooks' ) . '</strong></p></div>';
|
| 215 |
}
|
| 216 |
+
elseif( isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true' ) {
|
| 217 |
+
echo '<div id="message" class="updated" id="message"><p><strong>' . __( 'Modifications Saved', 'simplehooks' ) . '</strong></p></div>';
|
| 218 |
}
|
| 219 |
?>
|
| 220 |
+
|
| 221 |
<div class="metabox-holder">
|
| 222 |
<div class="postbox-container" style="<?php echo $width; ?>">
|
| 223 |
+
<?php do_meta_boxes( $_simplehooks_settings_pagehook, 'column1', null ); ?>
|
| 224 |
</div>
|
| 225 |
</div>
|
| 226 |
+
|
| 227 |
</form>
|
| 228 |
</div>
|
| 229 |
<script type="text/javascript">
|
| 230 |
//<![CDATA[
|
| 231 |
+
jQuery(document).ready(function($) {
|
| 232 |
// close postboxes that should be closed
|
| 233 |
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
| 234 |
// postboxes setup
|
boxes.php
CHANGED
|
@@ -5,363 +5,363 @@
|
|
| 5 |
*
|
| 6 |
*/
|
| 7 |
|
| 8 |
-
function simplehooks_wp_hooks_box() {
|
| 9 |
-
|
| 10 |
-
simplehooks_form_generate(array(
|
| 11 |
'hook' => 'wp_head',
|
| 12 |
-
'desc' => __('This hook executes immediately before the closing <code></head></code> tag.', 'simplehooks')
|
| 13 |
-
));
|
| 14 |
-
|
| 15 |
-
simplehooks_form_generate(array(
|
| 16 |
'hook' => 'wp_footer',
|
| 17 |
-
'desc' => __('This hook executes immediately before the closing <code></body></code> tag.', 'simplehooks')
|
| 18 |
-
));
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
}
|
| 23 |
|
| 24 |
function simplehooks_document_hooks_box() {
|
| 25 |
-
|
| 26 |
-
simplehooks_form_generate(array(
|
| 27 |
'hook' => 'genesis_title',
|
| 28 |
-
'desc' => __('This hook executes between the main document <code><title></title></code> tags.', 'simplehooks')
|
| 29 |
-
));
|
| 30 |
-
|
| 31 |
-
simplehooks_form_generate(array(
|
| 32 |
'hook' => 'genesis_meta',
|
| 33 |
-
'desc' => __('This hook executes in the document <code><head></code>.<br /> It is commonly used to output <code>META</code> information about the document.', 'simplehooks'),
|
| 34 |
-
'unhook' => array('genesis_load_favicon')
|
| 35 |
-
));
|
| 36 |
-
|
| 37 |
-
simplehooks_form_generate(array(
|
| 38 |
'hook' => 'genesis_before',
|
| 39 |
-
'desc' => __('This hook executes immediately after the opening <code><body></code> tag.', 'simplehooks')
|
| 40 |
-
));
|
| 41 |
-
|
| 42 |
-
simplehooks_form_generate(array(
|
| 43 |
'hook' => 'genesis_after',
|
| 44 |
-
'desc' => __('This hook executes immediately before the closing <code></body></code> tag.', 'simplehooks')
|
| 45 |
-
));
|
| 46 |
-
|
| 47 |
-
|
| 48 |
|
| 49 |
}
|
| 50 |
|
| 51 |
-
function simplehooks_header_hooks_box() {
|
| 52 |
|
| 53 |
-
simplehooks_form_generate(array(
|
| 54 |
'hook' => 'genesis_before_header',
|
| 55 |
-
'desc' => __('This hook executes immediately before the header (outside the <code>#header</code> div).', 'simplehooks')
|
| 56 |
-
));
|
| 57 |
-
|
| 58 |
-
simplehooks_form_generate(array(
|
| 59 |
'hook' => 'genesis_header',
|
| 60 |
-
'desc' => __('This hook outputs the default header (the <code>#header</code> div)', 'simplehooks'),
|
| 61 |
-
'unhook' => array('genesis_do_header')
|
| 62 |
-
));
|
| 63 |
-
|
| 64 |
-
simplehooks_form_generate(array(
|
| 65 |
'hook' => 'genesis_after_header',
|
| 66 |
-
'desc' => __('This hook executes immediately after the header (outside the <code>#header</code> div).', 'simplehooks')
|
| 67 |
-
));
|
| 68 |
-
|
| 69 |
-
|
| 70 |
|
| 71 |
}
|
| 72 |
|
| 73 |
function simplehooks_content_hooks_box() {
|
| 74 |
-
|
| 75 |
-
simplehooks_form_generate(array(
|
| 76 |
'hook' => 'genesis_before_content_sidebar_wrap',
|
| 77 |
-
'desc' => __('This hook executes immediately before the div block that wraps the content and the primary sidebar (outside the <code>#content-sidebar-wrap</code> div).', 'simplehooks')
|
| 78 |
-
));
|
| 79 |
-
|
| 80 |
-
simplehooks_form_generate(array(
|
| 81 |
'hook' => 'genesis_after_content_sidebar_wrap',
|
| 82 |
-
'desc' => __('This hook executes immediately after the div block that wraps the content and the primary sidebar (outside the <code>#content-sidebar-wrap</code> div).', 'simplehooks')
|
| 83 |
-
));
|
| 84 |
-
|
| 85 |
-
simplehooks_form_generate(array(
|
| 86 |
'hook' => 'genesis_before_content',
|
| 87 |
-
'desc' => __('This hook executes immediately before the content column (outside the <code>#content</code> div).', 'simplehooks')
|
| 88 |
-
));
|
| 89 |
-
|
| 90 |
-
simplehooks_form_generate(array(
|
| 91 |
'hook' => 'genesis_after_content',
|
| 92 |
-
'desc' => __('This hook executes immediately after the content column (outside the <code>#content</code> div).', 'simplehooks')
|
| 93 |
-
));
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
}
|
| 98 |
|
| 99 |
function simplehooks_loop_hooks_box() {
|
| 100 |
-
|
| 101 |
-
simplehooks_form_generate(array(
|
| 102 |
'hook' => 'genesis_before_loop',
|
| 103 |
-
'desc' => __('This hook executes immediately before all loop blocks.<br /> Therefore, this hook falls outside the loop, and cannot execute functions that require loop template tags or variables.', 'simplehooks')
|
| 104 |
-
));
|
| 105 |
-
|
| 106 |
-
simplehooks_form_generate(array(
|
| 107 |
'hook' => 'genesis_loop',
|
| 108 |
-
'desc' => __('This hook executes both default and custom loops.', 'simplehooks'),
|
| 109 |
-
'unhook' => array('genesis_do_loop')
|
| 110 |
-
));
|
| 111 |
-
|
| 112 |
-
simplehooks_form_generate(array(
|
| 113 |
'hook' => 'genesis_after_loop',
|
| 114 |
-
'desc' => __('This hook executes immediately after all loop blocks.<br /> Therefore, this hook falls outside the loop, and cannot execute functions that require loop template tags or variables.', 'simplehooks')
|
| 115 |
-
));
|
| 116 |
-
|
| 117 |
-
simplehooks_form_generate(array(
|
| 118 |
'hook' => 'genesis_after_endwhile',
|
| 119 |
-
'desc' => __('This hook executes after the <code>endwhile;</code> statement.', 'simplehooks'),
|
| 120 |
-
'unhook' => array('genesis_posts_nav')
|
| 121 |
-
));
|
| 122 |
-
|
| 123 |
-
simplehooks_form_generate(array(
|
| 124 |
'hook' => 'genesis_loop_else',
|
| 125 |
-
'desc' => __('This hook executes after the <code>else :</code> statement in all loop blocks. The content attached to this hook will only display if there are no posts available when a loop is executed.', 'simplehooks'),
|
| 126 |
-
'unhook' => array('genesis_do_noposts')
|
| 127 |
-
));
|
| 128 |
-
|
| 129 |
-
|
| 130 |
|
| 131 |
}
|
| 132 |
|
| 133 |
function simplehooks_post_hooks_box() {
|
| 134 |
-
|
| 135 |
-
simplehooks_form_generate(array(
|
| 136 |
'hook' => 'genesis_before_post',
|
| 137 |
-
'desc' => __('This hook executes before each post in all loop blocks (outside the <code>post_class()</code> div).', 'simplehooks')
|
| 138 |
-
));
|
| 139 |
-
|
| 140 |
-
simplehooks_form_generate(array(
|
| 141 |
'hook' => 'genesis_after_post',
|
| 142 |
-
'desc' => __('This hook executes after each post in all loop blocks (outside the <code>post_class()</code> div).', 'simplehooks'),
|
| 143 |
-
'unhook' => array('genesis_do_author_box')
|
| 144 |
-
));
|
| 145 |
-
|
| 146 |
-
simplehooks_form_generate(array(
|
| 147 |
'hook' => 'genesis_before_post_title',
|
| 148 |
-
'desc' => __('This hook executes immediately before each post/page title within the loop.', 'simplehooks')
|
| 149 |
-
));
|
| 150 |
-
|
| 151 |
-
simplehooks_form_generate(array(
|
| 152 |
'hook' => 'genesis_post_title',
|
| 153 |
-
'desc' => __('This hook outputs the post/page title.', 'simplehooks'),
|
| 154 |
-
'unhook' => array('genesis_do_post_title')
|
| 155 |
-
));
|
| 156 |
-
|
| 157 |
-
simplehooks_form_generate(array(
|
| 158 |
'hook' => 'genesis_after_post_title',
|
| 159 |
-
'desc' => __('This hook executes immediately after each post/page title within the loop.', 'simplehooks')
|
| 160 |
-
));
|
| 161 |
-
|
| 162 |
-
simplehooks_form_generate(array(
|
| 163 |
'hook' => 'genesis_before_post_content',
|
| 164 |
-
'desc' => __('This hook executes immediately before the <code>genesis_post_content</code> hook for each post/page within the loop.', 'simplehooks'),
|
| 165 |
-
'unhook' => array('genesis_post_info')
|
| 166 |
-
));
|
| 167 |
-
|
| 168 |
-
simplehooks_form_generate(array(
|
| 169 |
'hook' => 'genesis_post_content',
|
| 170 |
-
'desc' => __('This hook outputs the content of the post/page, by default.', 'simplehooks'),
|
| 171 |
-
'unhook' => array('genesis_do_post_image', 'genesis_do_post_content')
|
| 172 |
-
));
|
| 173 |
-
|
| 174 |
-
simplehooks_form_generate(array(
|
| 175 |
'hook' => 'genesis_after_post_content',
|
| 176 |
-
'desc' => __('This hook executes immediately after the <code>genesis_post_content</code> hook for each post/page within the loop.', 'simplehooks'),
|
| 177 |
-
'unhook' => array('genesis_post_meta')
|
| 178 |
-
));
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
}
|
| 183 |
|
| 184 |
-
function simplehooks_comment_list_hooks_box() {
|
| 185 |
-
|
| 186 |
-
simplehooks_form_generate(array(
|
| 187 |
'hook' => 'genesis_before_comments',
|
| 188 |
-
'desc' => __('This hook executes immediately before the comments block (outside the <code>#comments</code> div).', 'simplehooks')
|
| 189 |
-
));
|
| 190 |
-
|
| 191 |
-
simplehooks_form_generate(array(
|
| 192 |
'hook' => 'genesis_comments',
|
| 193 |
-
'desc' => __('This hook outputs the comments block, including the <code>#comments</code> div.', 'simplehooks'),
|
| 194 |
-
'unhook' => array('genesis_do_comments')
|
| 195 |
-
));
|
| 196 |
-
|
| 197 |
-
simplehooks_form_generate(array(
|
| 198 |
'hook' => 'genesis_list_comments',
|
| 199 |
-
'desc' => __('This hook executes inside the comments block, inside the <code>.comment-list</code> OL. By default, it outputs a list of comments associated with a post via the <code>genesis_default_list_comments()</code> function.', 'simplehooks'),
|
| 200 |
-
'unhook' => array('genesis_default_list_comments')
|
| 201 |
-
));
|
| 202 |
-
|
| 203 |
-
simplehooks_form_generate(array(
|
| 204 |
'hook' => 'genesis_after_comments',
|
| 205 |
-
'desc' => __('This hook executes immediately after the comments block (outside the <code>#comments</code> div).', 'simplehooks')
|
| 206 |
-
));
|
| 207 |
-
|
| 208 |
}
|
| 209 |
|
| 210 |
-
function simplehooks_ping_list_hooks_box() {
|
| 211 |
-
|
| 212 |
-
simplehooks_form_generate(array(
|
| 213 |
'hook' => 'genesis_before_pings',
|
| 214 |
-
'desc' => __('This hook executes immediately before the pings block (outside the <code>#pings</code> div).', 'simplehooks'),
|
| 215 |
-
'unhook' => array('genesis_do_pings')
|
| 216 |
-
));
|
| 217 |
-
|
| 218 |
-
simplehooks_form_generate(array(
|
| 219 |
'hook' => 'genesis_pings',
|
| 220 |
-
'desc' => __('This hook outputs the pings block, including the <code>#pings</code> div.', 'simplehooks')
|
| 221 |
-
));
|
| 222 |
-
|
| 223 |
-
simplehooks_form_generate(array(
|
| 224 |
'hook' => 'genesis_list_pings',
|
| 225 |
-
'desc' => __('This hook executes inside the pings block, inside the <code>.ping-list</code> OL. By default, it outputs a list of pings associated with a post via the <code>genesis_default_list_pings()</code> function.', 'simplehooks'),
|
| 226 |
-
'unhook' => array('genesis_default_list_pings')
|
| 227 |
-
));
|
| 228 |
-
|
| 229 |
-
simplehooks_form_generate(array(
|
| 230 |
'hook' => 'genesis_after_pings',
|
| 231 |
-
'desc' => __('This hook executes immediately after the pings block (outside the <code>#pings</code> div).', 'simplehooks')
|
| 232 |
-
));
|
| 233 |
-
|
| 234 |
-
|
| 235 |
|
| 236 |
}
|
| 237 |
|
| 238 |
function simplehooks_comment_hooks_box() {
|
| 239 |
-
|
| 240 |
-
simplehooks_form_generate(array(
|
| 241 |
'hook' => 'genesis_before_comment',
|
| 242 |
-
'desc' => __('This hook executes immediately before each individual comment (inside the <code>.comment</code> list item).', 'simplehooks')
|
| 243 |
-
));
|
| 244 |
-
|
| 245 |
-
simplehooks_form_generate(array(
|
| 246 |
'hook' => 'genesis_after_comment',
|
| 247 |
-
'desc' => __('This hook executes immediately after each individual comment (inside the <code>.comment</code> list item).', 'simplehooks')
|
| 248 |
-
));
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
}
|
| 253 |
|
| 254 |
function simplehooks_comment_form_hooks_box() {
|
| 255 |
-
|
| 256 |
-
simplehooks_form_generate(array(
|
| 257 |
'hook' => 'genesis_before_comment_form',
|
| 258 |
-
'desc' => __('This hook executes immediately before the comment form, outside the <code>#respond</code> div.', 'simplehooks')
|
| 259 |
-
));
|
| 260 |
-
|
| 261 |
-
simplehooks_form_generate(array(
|
| 262 |
'hook' => 'genesis_comment_form',
|
| 263 |
-
'desc' => __('This hook outputs the entire comment form, including the <code>#respond</code> div.', 'simplehooks'),
|
| 264 |
-
'unhook' => array('genesis_do_comment_form')
|
| 265 |
-
));
|
| 266 |
-
|
| 267 |
-
simplehooks_form_generate(array(
|
| 268 |
'hook' => 'genesis_after_comment_form',
|
| 269 |
-
'desc' => __('This hook executes immediately after the comment form, outside the <code>#respond</code> div.', 'simplehooks')
|
| 270 |
-
));
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
}
|
| 275 |
|
| 276 |
function simplehooks_sidebar_hooks_box() {
|
| 277 |
-
|
| 278 |
-
simplehooks_form_generate(array(
|
| 279 |
'hook' => 'genesis_before_sidebar',
|
| 280 |
-
'desc' => __('This hook executes immediately before the primary sidebar column (outside the <code>#sidebar</code> div).', 'simplehooks')
|
| 281 |
-
));
|
| 282 |
-
|
| 283 |
-
simplehooks_form_generate(array(
|
| 284 |
'hook' => 'genesis_sidebar',
|
| 285 |
-
'desc' => __('This hook outputs the content of the primary sidebar, including the widget area output.', 'simplehooks'),
|
| 286 |
-
'unhook' => array('genesis_do_sidebar')
|
| 287 |
-
));
|
| 288 |
-
|
| 289 |
-
simplehooks_form_generate(array(
|
| 290 |
'hook' => 'genesis_after_sidebar',
|
| 291 |
-
'desc' => __('This hook executes immediately after the primary sidebar column (outside the <code>#sidebar</code> div).', 'simplehooks')
|
| 292 |
-
));
|
| 293 |
-
|
| 294 |
-
simplehooks_form_generate(array(
|
| 295 |
'hook' => 'genesis_before_sidebar_widget_area',
|
| 296 |
-
'desc' => __('This hook executes immediately before the primary sidebar widget area (inside the <code>#sidebar</code> div).', 'simplehooks')
|
| 297 |
-
));
|
| 298 |
-
|
| 299 |
-
simplehooks_form_generate(array(
|
| 300 |
'hook' => 'genesis_after_sidebar_widget_area',
|
| 301 |
-
'desc' => __('This hook executes immediately after the primary sidebar widget area (inside the <code>#sidebar</code> div).', 'simplehooks')
|
| 302 |
-
));
|
| 303 |
-
|
| 304 |
-
simplehooks_form_generate(array(
|
| 305 |
'hook' => 'genesis_before_sidebar_alt',
|
| 306 |
-
'desc' => __('This hook executes immediately before the alternate sidebar column (outside the <code>#sidebar-alt</code> div).', 'simplehooks')
|
| 307 |
-
));
|
| 308 |
-
|
| 309 |
-
simplehooks_form_generate(array(
|
| 310 |
'hook' => 'genesis_sidebar_alt',
|
| 311 |
-
'desc' => __('This hook outputs the content of the secondary sidebar, including the widget area output.', 'simplehooks'),
|
| 312 |
-
'unhook' => array('genesis_do_sidebar_alt')
|
| 313 |
-
));
|
| 314 |
-
|
| 315 |
-
simplehooks_form_generate(array(
|
| 316 |
'hook' => 'genesis_after_sidebar_alt',
|
| 317 |
-
'desc' => __('This hook executes immediately after the alternate sidebar column (outside the <code>#sidebar-alt</code> div).', 'simplehooks')
|
| 318 |
-
));
|
| 319 |
-
|
| 320 |
-
simplehooks_form_generate(array(
|
| 321 |
'hook' => 'genesis_before_sidebar_alt_widget_area',
|
| 322 |
-
'desc' => __('This hook executes immediately before the alternate sidebar widget area (inside the <code>#sidebar-alt</code> div).', 'simplehooks')
|
| 323 |
-
));
|
| 324 |
-
|
| 325 |
-
simplehooks_form_generate(array(
|
| 326 |
'hook' => 'genesis_after_sidebar_alt_widget_area',
|
| 327 |
-
'desc' => __('This hook executes immediately after the alternate sidebar widget area (inside the <code>#sidebar-alt</code> div).', 'simplehooks')
|
| 328 |
-
));
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
}
|
| 333 |
|
| 334 |
function simplehooks_footer_hooks_box() {
|
| 335 |
-
|
| 336 |
-
simplehooks_form_generate(array(
|
| 337 |
'hook' => 'genesis_before_footer',
|
| 338 |
-
'desc' => __('This hook executes immediately before the footer (outside the <code>#footer</code> div).', 'simplehooks')
|
| 339 |
-
));
|
| 340 |
-
|
| 341 |
-
simplehooks_form_generate(array(
|
| 342 |
'hook' => 'genesis_footer',
|
| 343 |
-
'desc' => __('This hook, by default, outputs the content of the footer (inside the <code>#footer</code> div).', 'simplehooks'),
|
| 344 |
-
'unhook' => array('genesis_do_footer')
|
| 345 |
-
));
|
| 346 |
-
|
| 347 |
-
simplehooks_form_generate(array(
|
| 348 |
'hook' => 'genesis_after_footer',
|
| 349 |
-
'desc' => __('This hook executes immediately after the footer (outside the <code>#footer</code> div).', 'simplehooks')
|
| 350 |
-
));
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
}
|
| 355 |
|
| 356 |
/* Sample box and box content
|
| 357 |
function simplehooks__hooks_box() {
|
| 358 |
-
|
| 359 |
simplehooks_form_generate(array(
|
| 360 |
'hook' => 'genesis_',
|
| 361 |
-
'desc' => __('', 'simplehooks')
|
| 362 |
-
));
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
}
|
| 367 |
*/
|
| 5 |
*
|
| 6 |
*/
|
| 7 |
|
| 8 |
+
function simplehooks_wp_hooks_box() {
|
| 9 |
+
|
| 10 |
+
simplehooks_form_generate( array(
|
| 11 |
'hook' => 'wp_head',
|
| 12 |
+
'desc' => __( 'This hook executes immediately before the closing <code></head></code> tag.', 'simplehooks' )
|
| 13 |
+
) );
|
| 14 |
+
|
| 15 |
+
simplehooks_form_generate( array(
|
| 16 |
'hook' => 'wp_footer',
|
| 17 |
+
'desc' => __( 'This hook executes immediately before the closing <code></body></code> tag.', 'simplehooks' )
|
| 18 |
+
) );
|
| 19 |
+
|
| 20 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 21 |
|
| 22 |
}
|
| 23 |
|
| 24 |
function simplehooks_document_hooks_box() {
|
| 25 |
+
|
| 26 |
+
simplehooks_form_generate( array(
|
| 27 |
'hook' => 'genesis_title',
|
| 28 |
+
'desc' => __( 'This hook executes between the main document <code><title></title></code> tags.', 'simplehooks' )
|
| 29 |
+
) );
|
| 30 |
+
|
| 31 |
+
simplehooks_form_generate( array(
|
| 32 |
'hook' => 'genesis_meta',
|
| 33 |
+
'desc' => __( 'This hook executes in the document <code><head></code>.<br /> It is commonly used to output <code>META</code> information about the document.', 'simplehooks' ),
|
| 34 |
+
'unhook' => array( 'genesis_load_favicon' )
|
| 35 |
+
) );
|
| 36 |
+
|
| 37 |
+
simplehooks_form_generate( array(
|
| 38 |
'hook' => 'genesis_before',
|
| 39 |
+
'desc' => __( 'This hook executes immediately after the opening <code><body></code> tag.', 'simplehooks' )
|
| 40 |
+
) );
|
| 41 |
+
|
| 42 |
+
simplehooks_form_generate( array(
|
| 43 |
'hook' => 'genesis_after',
|
| 44 |
+
'desc' => __( 'This hook executes immediately before the closing <code></body></code> tag.', 'simplehooks' )
|
| 45 |
+
) );
|
| 46 |
+
|
| 47 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 48 |
|
| 49 |
}
|
| 50 |
|
| 51 |
+
function simplehooks_header_hooks_box() {
|
| 52 |
|
| 53 |
+
simplehooks_form_generate( array(
|
| 54 |
'hook' => 'genesis_before_header',
|
| 55 |
+
'desc' => __( 'This hook executes immediately before the header (outside the <code>#header</code> div).', 'simplehooks' )
|
| 56 |
+
) );
|
| 57 |
+
|
| 58 |
+
simplehooks_form_generate( array(
|
| 59 |
'hook' => 'genesis_header',
|
| 60 |
+
'desc' => __( 'This hook outputs the default header (the <code>#header</code> div)', 'simplehooks' ),
|
| 61 |
+
'unhook' => array( 'genesis_do_header' )
|
| 62 |
+
) );
|
| 63 |
+
|
| 64 |
+
simplehooks_form_generate( array(
|
| 65 |
'hook' => 'genesis_after_header',
|
| 66 |
+
'desc' => __( 'This hook executes immediately after the header (outside the <code>#header</code> div).', 'simplehooks' )
|
| 67 |
+
) );
|
| 68 |
+
|
| 69 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 70 |
|
| 71 |
}
|
| 72 |
|
| 73 |
function simplehooks_content_hooks_box() {
|
| 74 |
+
|
| 75 |
+
simplehooks_form_generate( array(
|
| 76 |
'hook' => 'genesis_before_content_sidebar_wrap',
|
| 77 |
+
'desc' => __( 'This hook executes immediately before the div block that wraps the content and the primary sidebar (outside the <code>#content-sidebar-wrap</code> div).', 'simplehooks' )
|
| 78 |
+
) );
|
| 79 |
+
|
| 80 |
+
simplehooks_form_generate( array(
|
| 81 |
'hook' => 'genesis_after_content_sidebar_wrap',
|
| 82 |
+
'desc' => __( 'This hook executes immediately after the div block that wraps the content and the primary sidebar (outside the <code>#content-sidebar-wrap</code> div).', 'simplehooks' )
|
| 83 |
+
) );
|
| 84 |
+
|
| 85 |
+
simplehooks_form_generate( array(
|
| 86 |
'hook' => 'genesis_before_content',
|
| 87 |
+
'desc' => __( 'This hook executes immediately before the content column (outside the <code>#content</code> div).', 'simplehooks' )
|
| 88 |
+
) );
|
| 89 |
+
|
| 90 |
+
simplehooks_form_generate( array(
|
| 91 |
'hook' => 'genesis_after_content',
|
| 92 |
+
'desc' => __( 'This hook executes immediately after the content column (outside the <code>#content</code> div).', 'simplehooks' )
|
| 93 |
+
) );
|
| 94 |
+
|
| 95 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 96 |
+
|
| 97 |
}
|
| 98 |
|
| 99 |
function simplehooks_loop_hooks_box() {
|
| 100 |
+
|
| 101 |
+
simplehooks_form_generate( array(
|
| 102 |
'hook' => 'genesis_before_loop',
|
| 103 |
+
'desc' => __( 'This hook executes immediately before all loop blocks.<br /> Therefore, this hook falls outside the loop, and cannot execute functions that require loop template tags or variables.', 'simplehooks' )
|
| 104 |
+
) );
|
| 105 |
+
|
| 106 |
+
simplehooks_form_generate( array(
|
| 107 |
'hook' => 'genesis_loop',
|
| 108 |
+
'desc' => __( 'This hook executes both default and custom loops.', 'simplehooks' ),
|
| 109 |
+
'unhook' => array( 'genesis_do_loop' )
|
| 110 |
+
) );
|
| 111 |
+
|
| 112 |
+
simplehooks_form_generate( array(
|
| 113 |
'hook' => 'genesis_after_loop',
|
| 114 |
+
'desc' => __( 'This hook executes immediately after all loop blocks.<br /> Therefore, this hook falls outside the loop, and cannot execute functions that require loop template tags or variables.', 'simplehooks' )
|
| 115 |
+
) );
|
| 116 |
+
|
| 117 |
+
simplehooks_form_generate( array(
|
| 118 |
'hook' => 'genesis_after_endwhile',
|
| 119 |
+
'desc' => __( 'This hook executes after the <code>endwhile;</code> statement.', 'simplehooks' ),
|
| 120 |
+
'unhook' => array( 'genesis_posts_nav' )
|
| 121 |
+
) );
|
| 122 |
+
|
| 123 |
+
simplehooks_form_generate( array(
|
| 124 |
'hook' => 'genesis_loop_else',
|
| 125 |
+
'desc' => __( 'This hook executes after the <code>else :</code> statement in all loop blocks. The content attached to this hook will only display if there are no posts available when a loop is executed.', 'simplehooks' ),
|
| 126 |
+
'unhook' => array( 'genesis_do_noposts' )
|
| 127 |
+
) );
|
| 128 |
+
|
| 129 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 130 |
|
| 131 |
}
|
| 132 |
|
| 133 |
function simplehooks_post_hooks_box() {
|
| 134 |
+
|
| 135 |
+
simplehooks_form_generate( array(
|
| 136 |
'hook' => 'genesis_before_post',
|
| 137 |
+
'desc' => __( 'This hook executes before each post in all loop blocks (outside the <code>post_class()</code> div).', 'simplehooks' )
|
| 138 |
+
) );
|
| 139 |
+
|
| 140 |
+
simplehooks_form_generate( array(
|
| 141 |
'hook' => 'genesis_after_post',
|
| 142 |
+
'desc' => __( 'This hook executes after each post in all loop blocks (outside the <code>post_class()</code> div).', 'simplehooks' ),
|
| 143 |
+
'unhook' => array( 'genesis_do_author_box' )
|
| 144 |
+
) );
|
| 145 |
+
|
| 146 |
+
simplehooks_form_generate( array(
|
| 147 |
'hook' => 'genesis_before_post_title',
|
| 148 |
+
'desc' => __( 'This hook executes immediately before each post/page title within the loop.', 'simplehooks' )
|
| 149 |
+
) );
|
| 150 |
+
|
| 151 |
+
simplehooks_form_generate( array(
|
| 152 |
'hook' => 'genesis_post_title',
|
| 153 |
+
'desc' => __( 'This hook outputs the post/page title.', 'simplehooks' ),
|
| 154 |
+
'unhook' => array( 'genesis_do_post_title' )
|
| 155 |
+
) );
|
| 156 |
+
|
| 157 |
+
simplehooks_form_generate( array(
|
| 158 |
'hook' => 'genesis_after_post_title',
|
| 159 |
+
'desc' => __( 'This hook executes immediately after each post/page title within the loop.', 'simplehooks' )
|
| 160 |
+
) );
|
| 161 |
+
|
| 162 |
+
simplehooks_form_generate( array(
|
| 163 |
'hook' => 'genesis_before_post_content',
|
| 164 |
+
'desc' => __( 'This hook executes immediately before the <code>genesis_post_content</code> hook for each post/page within the loop.', 'simplehooks' ),
|
| 165 |
+
'unhook' => array( 'genesis_post_info' )
|
| 166 |
+
) );
|
| 167 |
+
|
| 168 |
+
simplehooks_form_generate( array(
|
| 169 |
'hook' => 'genesis_post_content',
|
| 170 |
+
'desc' => __( 'This hook outputs the content of the post/page, by default.', 'simplehooks' ),
|
| 171 |
+
'unhook' => array( 'genesis_do_post_image', 'genesis_do_post_content' )
|
| 172 |
+
) );
|
| 173 |
+
|
| 174 |
+
simplehooks_form_generate( array(
|
| 175 |
'hook' => 'genesis_after_post_content',
|
| 176 |
+
'desc' => __( 'This hook executes immediately after the <code>genesis_post_content</code> hook for each post/page within the loop.', 'simplehooks' ),
|
| 177 |
+
'unhook' => array( 'genesis_post_meta' )
|
| 178 |
+
) );
|
| 179 |
+
|
| 180 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 181 |
+
|
| 182 |
}
|
| 183 |
|
| 184 |
+
function simplehooks_comment_list_hooks_box() {
|
| 185 |
+
|
| 186 |
+
simplehooks_form_generate( array(
|
| 187 |
'hook' => 'genesis_before_comments',
|
| 188 |
+
'desc' => __( 'This hook executes immediately before the comments block (outside the <code>#comments</code> div).', 'simplehooks' )
|
| 189 |
+
) );
|
| 190 |
+
|
| 191 |
+
simplehooks_form_generate( array(
|
| 192 |
'hook' => 'genesis_comments',
|
| 193 |
+
'desc' => __( 'This hook outputs the comments block, including the <code>#comments</code> div.', 'simplehooks' ),
|
| 194 |
+
'unhook' => array( 'genesis_do_comments' )
|
| 195 |
+
) );
|
| 196 |
+
|
| 197 |
+
simplehooks_form_generate( array(
|
| 198 |
'hook' => 'genesis_list_comments',
|
| 199 |
+
'desc' => __( 'This hook executes inside the comments block, inside the <code>.comment-list</code> OL. By default, it outputs a list of comments associated with a post via the <code>genesis_default_list_comments()</code> function.', 'simplehooks' ),
|
| 200 |
+
'unhook' => array( 'genesis_default_list_comments' )
|
| 201 |
+
) );
|
| 202 |
+
|
| 203 |
+
simplehooks_form_generate( array(
|
| 204 |
'hook' => 'genesis_after_comments',
|
| 205 |
+
'desc' => __( 'This hook executes immediately after the comments block (outside the <code>#comments</code> div).', 'simplehooks' )
|
| 206 |
+
) );
|
| 207 |
+
|
| 208 |
}
|
| 209 |
|
| 210 |
+
function simplehooks_ping_list_hooks_box() {
|
| 211 |
+
|
| 212 |
+
simplehooks_form_generate( array(
|
| 213 |
'hook' => 'genesis_before_pings',
|
| 214 |
+
'desc' => __( 'This hook executes immediately before the pings block (outside the <code>#pings</code> div).', 'simplehooks' ),
|
| 215 |
+
'unhook' => array( 'genesis_do_pings' )
|
| 216 |
+
) );
|
| 217 |
+
|
| 218 |
+
simplehooks_form_generate( array(
|
| 219 |
'hook' => 'genesis_pings',
|
| 220 |
+
'desc' => __( 'This hook outputs the pings block, including the <code>#pings</code> div.', 'simplehooks' )
|
| 221 |
+
) );
|
| 222 |
+
|
| 223 |
+
simplehooks_form_generate( array(
|
| 224 |
'hook' => 'genesis_list_pings',
|
| 225 |
+
'desc' => __( 'This hook executes inside the pings block, inside the <code>.ping-list</code> OL. By default, it outputs a list of pings associated with a post via the <code>genesis_default_list_pings()</code> function.', 'simplehooks' ),
|
| 226 |
+
'unhook' => array( 'genesis_default_list_pings' )
|
| 227 |
+
) );
|
| 228 |
+
|
| 229 |
+
simplehooks_form_generate( array(
|
| 230 |
'hook' => 'genesis_after_pings',
|
| 231 |
+
'desc' => __( 'This hook executes immediately after the pings block (outside the <code>#pings</code> div).', 'simplehooks' )
|
| 232 |
+
) );
|
| 233 |
+
|
| 234 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 235 |
|
| 236 |
}
|
| 237 |
|
| 238 |
function simplehooks_comment_hooks_box() {
|
| 239 |
+
|
| 240 |
+
simplehooks_form_generate( array(
|
| 241 |
'hook' => 'genesis_before_comment',
|
| 242 |
+
'desc' => __( 'This hook executes immediately before each individual comment (inside the <code>.comment</code> list item).', 'simplehooks' )
|
| 243 |
+
) );
|
| 244 |
+
|
| 245 |
+
simplehooks_form_generate( array(
|
| 246 |
'hook' => 'genesis_after_comment',
|
| 247 |
+
'desc' => __( 'This hook executes immediately after each individual comment (inside the <code>.comment</code> list item).', 'simplehooks' )
|
| 248 |
+
) );
|
| 249 |
+
|
| 250 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 251 |
+
|
| 252 |
}
|
| 253 |
|
| 254 |
function simplehooks_comment_form_hooks_box() {
|
| 255 |
+
|
| 256 |
+
simplehooks_form_generate( array(
|
| 257 |
'hook' => 'genesis_before_comment_form',
|
| 258 |
+
'desc' => __( 'This hook executes immediately before the comment form, outside the <code>#respond</code> div.', 'simplehooks' )
|
| 259 |
+
) );
|
| 260 |
+
|
| 261 |
+
simplehooks_form_generate( array(
|
| 262 |
'hook' => 'genesis_comment_form',
|
| 263 |
+
'desc' => __( 'This hook outputs the entire comment form, including the <code>#respond</code> div.', 'simplehooks' ),
|
| 264 |
+
'unhook' => array( 'genesis_do_comment_form' )
|
| 265 |
+
) );
|
| 266 |
+
|
| 267 |
+
simplehooks_form_generate( array(
|
| 268 |
'hook' => 'genesis_after_comment_form',
|
| 269 |
+
'desc' => __( 'This hook executes immediately after the comment form, outside the <code>#respond</code> div.', 'simplehooks' )
|
| 270 |
+
) );
|
| 271 |
+
|
| 272 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 273 |
+
|
| 274 |
}
|
| 275 |
|
| 276 |
function simplehooks_sidebar_hooks_box() {
|
| 277 |
+
|
| 278 |
+
simplehooks_form_generate( array(
|
| 279 |
'hook' => 'genesis_before_sidebar',
|
| 280 |
+
'desc' => __( 'This hook executes immediately before the primary sidebar column (outside the <code>#sidebar</code> div).', 'simplehooks' )
|
| 281 |
+
) );
|
| 282 |
+
|
| 283 |
+
simplehooks_form_generate( array(
|
| 284 |
'hook' => 'genesis_sidebar',
|
| 285 |
+
'desc' => __( 'This hook outputs the content of the primary sidebar, including the widget area output.', 'simplehooks' ),
|
| 286 |
+
'unhook' => array( 'genesis_do_sidebar' )
|
| 287 |
+
) );
|
| 288 |
+
|
| 289 |
+
simplehooks_form_generate( array(
|
| 290 |
'hook' => 'genesis_after_sidebar',
|
| 291 |
+
'desc' => __( 'This hook executes immediately after the primary sidebar column (outside the <code>#sidebar</code> div).', 'simplehooks' )
|
| 292 |
+
) );
|
| 293 |
+
|
| 294 |
+
simplehooks_form_generate( array(
|
| 295 |
'hook' => 'genesis_before_sidebar_widget_area',
|
| 296 |
+
'desc' => __( 'This hook executes immediately before the primary sidebar widget area (inside the <code>#sidebar</code> div).', 'simplehooks' )
|
| 297 |
+
) );
|
| 298 |
+
|
| 299 |
+
simplehooks_form_generate( array(
|
| 300 |
'hook' => 'genesis_after_sidebar_widget_area',
|
| 301 |
+
'desc' => __( 'This hook executes immediately after the primary sidebar widget area (inside the <code>#sidebar</code> div).', 'simplehooks' )
|
| 302 |
+
) );
|
| 303 |
+
|
| 304 |
+
simplehooks_form_generate( array(
|
| 305 |
'hook' => 'genesis_before_sidebar_alt',
|
| 306 |
+
'desc' => __( 'This hook executes immediately before the alternate sidebar column (outside the <code>#sidebar-alt</code> div).', 'simplehooks' )
|
| 307 |
+
) );
|
| 308 |
+
|
| 309 |
+
simplehooks_form_generate( array(
|
| 310 |
'hook' => 'genesis_sidebar_alt',
|
| 311 |
+
'desc' => __( 'This hook outputs the content of the secondary sidebar, including the widget area output.', 'simplehooks' ),
|
| 312 |
+
'unhook' => array( 'genesis_do_sidebar_alt' )
|
| 313 |
+
) );
|
| 314 |
+
|
| 315 |
+
simplehooks_form_generate( array(
|
| 316 |
'hook' => 'genesis_after_sidebar_alt',
|
| 317 |
+
'desc' => __( 'This hook executes immediately after the alternate sidebar column (outside the <code>#sidebar-alt</code> div).', 'simplehooks' )
|
| 318 |
+
) );
|
| 319 |
+
|
| 320 |
+
simplehooks_form_generate( array(
|
| 321 |
'hook' => 'genesis_before_sidebar_alt_widget_area',
|
| 322 |
+
'desc' => __( 'This hook executes immediately before the alternate sidebar widget area (inside the <code>#sidebar-alt</code> div).', 'simplehooks' )
|
| 323 |
+
) );
|
| 324 |
+
|
| 325 |
+
simplehooks_form_generate( array(
|
| 326 |
'hook' => 'genesis_after_sidebar_alt_widget_area',
|
| 327 |
+
'desc' => __( 'This hook executes immediately after the alternate sidebar widget area (inside the <code>#sidebar-alt</code> div).', 'simplehooks' )
|
| 328 |
+
) );
|
| 329 |
+
|
| 330 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 331 |
+
|
| 332 |
}
|
| 333 |
|
| 334 |
function simplehooks_footer_hooks_box() {
|
| 335 |
+
|
| 336 |
+
simplehooks_form_generate( array(
|
| 337 |
'hook' => 'genesis_before_footer',
|
| 338 |
+
'desc' => __( 'This hook executes immediately before the footer (outside the <code>#footer</code> div).', 'simplehooks' )
|
| 339 |
+
) );
|
| 340 |
+
|
| 341 |
+
simplehooks_form_generate( array(
|
| 342 |
'hook' => 'genesis_footer',
|
| 343 |
+
'desc' => __( 'This hook, by default, outputs the content of the footer (inside the <code>#footer</code> div).', 'simplehooks' ),
|
| 344 |
+
'unhook' => array( 'genesis_do_footer' )
|
| 345 |
+
) );
|
| 346 |
+
|
| 347 |
+
simplehooks_form_generate( array(
|
| 348 |
'hook' => 'genesis_after_footer',
|
| 349 |
+
'desc' => __( 'This hook executes immediately after the footer (outside the <code>#footer</code> div).', 'simplehooks' )
|
| 350 |
+
) );
|
| 351 |
+
|
| 352 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 353 |
+
|
| 354 |
}
|
| 355 |
|
| 356 |
/* Sample box and box content
|
| 357 |
function simplehooks__hooks_box() {
|
| 358 |
+
|
| 359 |
simplehooks_form_generate(array(
|
| 360 |
'hook' => 'genesis_',
|
| 361 |
+
'desc' => __( '', 'simplehooks' )
|
| 362 |
+
) );
|
| 363 |
+
|
| 364 |
+
submit_button( __( 'Save Changes', 'simplehooks' ), 'primary' );
|
| 365 |
+
|
| 366 |
}
|
| 367 |
*/
|
functions.php
CHANGED
|
@@ -5,20 +5,22 @@
|
|
| 5 |
*
|
| 6 |
* @since 0.1
|
| 7 |
*/
|
| 8 |
-
function simplehooks_get_option($hook = null, $field = null, $all = false) {
|
| 9 |
-
|
| 10 |
static $options = array();
|
| 11 |
-
|
| 12 |
-
$options = $options ? $options : get_option(SIMPLEHOOKS_SETTINGS_FIELD);
|
| 13 |
-
|
| 14 |
-
if( $all )
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
$option = isset( $options[$hook][$field] ) ? $options[$hook][$field] : '';
|
|
|
|
| 20 |
return wp_kses_stripslashes( wp_kses_decode_entities( $option ) );
|
| 21 |
-
|
| 22 |
}
|
| 23 |
/**
|
| 24 |
* Pull an EasyHook option from the database, echo value
|
|
@@ -26,7 +28,9 @@ function simplehooks_get_option($hook = null, $field = null, $all = false) {
|
|
| 26 |
* @since 0.1
|
| 27 |
*/
|
| 28 |
function simplehooks_option($hook = null, $field = null) {
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
|
| 32 |
/**
|
|
@@ -35,37 +39,34 @@ function simplehooks_option($hook = null, $field = null) {
|
|
| 35 |
* @since 0.1
|
| 36 |
*/
|
| 37 |
function simplehooks_form_generate( $args = array() ) {
|
| 38 |
-
|
| 39 |
?>
|
| 40 |
|
| 41 |
-
<h4><code><?php echo $args['hook']; ?></code> <?php _e('Hook', 'simplehooks'); ?></h4>
|
| 42 |
<p><span class="description"><?php echo $args['desc']; ?></span></p>
|
| 43 |
-
|
| 44 |
<?php
|
| 45 |
-
if( isset( $args['unhook'] ) ) {
|
| 46 |
-
|
| 47 |
-
foreach( (array)$args['unhook'] as $function ) {
|
| 48 |
?>
|
| 49 |
-
|
| 50 |
-
<input type="checkbox" name="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][unhook][]" id="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][unhook][]" value="<?php echo $function; ?>" <?php if( in_array( $function, (array)simplehooks_get_option($args['hook'], 'unhook') ) ) echo 'checked'; ?> /> <label for="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][unhook][]"><?php printf(__('Unhook <code>%s()</code> function from this hook?', 'simplehooks'), $function); ?></label><br />
|
| 51 |
-
|
| 52 |
<?php
|
| 53 |
}
|
| 54 |
-
|
| 55 |
}
|
| 56 |
?>
|
| 57 |
|
| 58 |
-
<p><textarea name="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][content]" cols="70" rows="5"><?php echo htmlentities( simplehooks_get_option($args['hook'], 'content'), ENT_QUOTES, 'UTF-8' ); ?></textarea></p>
|
| 59 |
|
| 60 |
<p>
|
| 61 |
-
<input type="checkbox" name="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][shortcodes]" id="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][shortcodes]" value="1" <?php checked(1, simplehooks_get_option($args['hook'], 'shortcodes')); ?> /> <label for="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][shortcodes]"><?php _e('Execute Shortcodes on this hook?', 'simplehooks'); ?></label><br />
|
| 62 |
-
<input type="checkbox" name="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][php]" id="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][php]" value="1" <?php checked(1, simplehooks_get_option($args['hook'], 'php')); ?> /> <label for="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][php]"><?php _e('Execute PHP on this hook?', 'simplehooks'); ?></label>
|
| 63 |
</p>
|
| 64 |
-
|
| 65 |
<hr class="div" />
|
| 66 |
|
| 67 |
<?php
|
| 68 |
-
}
|
| 69 |
-
function simplehooks_form_submit( $args = array() ) {
|
| 70 |
-
echo '<p><input type="submit" class="button-primary" value="'. __('Save Changes', 'simplehooks') .'" /></p>';
|
| 71 |
}
|
| 5 |
*
|
| 6 |
* @since 0.1
|
| 7 |
*/
|
| 8 |
+
function simplehooks_get_option( $hook = null, $field = null, $all = false ) {
|
| 9 |
+
|
| 10 |
static $options = array();
|
| 11 |
+
|
| 12 |
+
$options = $options ? $options : get_option( SIMPLEHOOKS_SETTINGS_FIELD );
|
| 13 |
+
|
| 14 |
+
if ( $all )
|
| 15 |
+
return $options;
|
| 16 |
+
|
| 17 |
+
if ( ! array_key_exists( $hook, (array) $options ) )
|
| 18 |
+
return '';
|
| 19 |
+
|
| 20 |
$option = isset( $options[$hook][$field] ) ? $options[$hook][$field] : '';
|
| 21 |
+
|
| 22 |
return wp_kses_stripslashes( wp_kses_decode_entities( $option ) );
|
| 23 |
+
|
| 24 |
}
|
| 25 |
/**
|
| 26 |
* Pull an EasyHook option from the database, echo value
|
| 28 |
* @since 0.1
|
| 29 |
*/
|
| 30 |
function simplehooks_option($hook = null, $field = null) {
|
| 31 |
+
|
| 32 |
+
echo simplehooks_get_option( $hook, $field );
|
| 33 |
+
|
| 34 |
}
|
| 35 |
|
| 36 |
/**
|
| 39 |
* @since 0.1
|
| 40 |
*/
|
| 41 |
function simplehooks_form_generate( $args = array() ) {
|
| 42 |
+
|
| 43 |
?>
|
| 44 |
|
| 45 |
+
<h4><code><?php echo $args['hook']; ?></code> <?php _e( 'Hook', 'simplehooks' ); ?></h4>
|
| 46 |
<p><span class="description"><?php echo $args['desc']; ?></span></p>
|
| 47 |
+
|
| 48 |
<?php
|
| 49 |
+
if ( isset( $args['unhook'] ) ) {
|
| 50 |
+
|
| 51 |
+
foreach ( (array) $args['unhook'] as $function ) {
|
| 52 |
?>
|
| 53 |
+
|
| 54 |
+
<input type="checkbox" name="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][unhook][]" id="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][unhook][]" value="<?php echo $function; ?>" <?php if ( in_array( $function, (array) simplehooks_get_option( $args['hook'], 'unhook' ) ) ) echo 'checked'; ?> /> <label for="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][unhook][]"><?php printf( __( 'Unhook <code>%s()</code> function from this hook?', 'simplehooks' ), $function ); ?></label><br />
|
| 55 |
+
|
| 56 |
<?php
|
| 57 |
}
|
| 58 |
+
|
| 59 |
}
|
| 60 |
?>
|
| 61 |
|
| 62 |
+
<p><textarea name="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][content]" cols="70" rows="5"><?php echo htmlentities( simplehooks_get_option( $args['hook'], 'content' ), ENT_QUOTES, 'UTF-8' ); ?></textarea></p>
|
| 63 |
|
| 64 |
<p>
|
| 65 |
+
<input type="checkbox" name="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][shortcodes]" id="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][shortcodes]" value="1" <?php checked( 1, simplehooks_get_option( $args['hook'], 'shortcodes' ) ); ?> /> <label for="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][shortcodes]"><?php _e( 'Execute Shortcodes on this hook?', 'simplehooks' ); ?></label><br />
|
| 66 |
+
<input type="checkbox" name="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][php]" id="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][php]" value="1" <?php checked( 1, simplehooks_get_option( $args['hook'], 'php' ) ); ?> /> <label for="<?php echo SIMPLEHOOKS_SETTINGS_FIELD; ?>[<?php echo $args['hook']; ?>][php]"><?php _e( 'Execute PHP on this hook?', 'simplehooks' ); ?></label>
|
| 67 |
</p>
|
| 68 |
+
|
| 69 |
<hr class="div" />
|
| 70 |
|
| 71 |
<?php
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
plugin.php
CHANGED
|
@@ -1,30 +1,39 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 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 |
-
|
| 7 |
-
Author:
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
*/
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
function
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
if ( version_compare( $theme_info['Version'], $latest, '<' ) ) {
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
}
|
| 30 |
|
|
@@ -45,29 +54,29 @@ require_once( SIMPLEHOOKS_PLUGIN_DIR . '/boxes.php' );
|
|
| 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 |
-
|
| 67 |
}
|
| 68 |
-
|
| 69 |
}
|
| 70 |
-
|
| 71 |
}
|
| 72 |
|
| 73 |
/**
|
|
@@ -77,20 +86,21 @@ function simplehooks_execute_hooks() {
|
|
| 77 |
* @since 0.1
|
| 78 |
*/
|
| 79 |
function simplehooks_execute_hook() {
|
| 80 |
-
|
| 81 |
$hook = current_filter();
|
| 82 |
$content = simplehooks_get_option( $hook, 'content' );
|
| 83 |
-
|
| 84 |
-
if( ! $hook || ! $content )
|
| 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;
|
| 95 |
|
| 96 |
}
|
| 1 |
<?php
|
| 2 |
/*
|
| 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 |
+
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 |
+
register_activation_hook( __FILE__, 'simplehooks_activation' );
|
| 16 |
+
/**
|
| 17 |
+
* This function runs on plugin activation. It checks to make sure the required
|
| 18 |
+
* minimum Genesis version is installed. If not, it deactivates itself.
|
| 19 |
+
*
|
| 20 |
+
* @since 0.1.0
|
| 21 |
+
*/
|
| 22 |
+
function simplehooks_activation() {
|
| 23 |
+
|
| 24 |
+
$latest = '1.7.1';
|
| 25 |
+
|
| 26 |
+
$theme_info = get_theme_data( TEMPLATEPATH . '/style.css' );
|
| 27 |
+
|
| 28 |
+
if ( 'genesis' != basename( TEMPLATEPATH ) ) {
|
| 29 |
+
deactivate_plugins( plugin_basename( __FILE__ ) ); /** Deactivate ourself */
|
| 30 |
+
wp_die( sprintf( __( 'Sorry, you can\'t activate unless you have installed <a href="%s">Genesis</a>', 'apl' ), 'http://www.studiopress.com/themes/genesis' ) );
|
| 31 |
}
|
| 32 |
|
| 33 |
if ( version_compare( $theme_info['Version'], $latest, '<' ) ) {
|
| 34 |
+
deactivate_plugins( plugin_basename( __FILE__ ) ); /** Deactivate ourself */
|
| 35 |
+
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 ) );
|
| 36 |
+
}
|
| 37 |
|
| 38 |
}
|
| 39 |
|
| 54 |
*/
|
| 55 |
add_action( 'genesis_init', 'simplehooks_execute_hooks', 20 );
|
| 56 |
function simplehooks_execute_hooks() {
|
| 57 |
+
|
| 58 |
$hooks = get_option( SIMPLEHOOKS_SETTINGS_FIELD );
|
| 59 |
+
|
| 60 |
+
foreach ( (array) $hooks as $hook => $array ) {
|
| 61 |
+
|
| 62 |
// Add new content to hook
|
| 63 |
+
if ( simplehooks_get_option( $hook, 'content' ) ) {
|
| 64 |
add_action( $hook, 'simplehooks_execute_hook' );
|
| 65 |
}
|
| 66 |
+
|
| 67 |
// Unhook stuff
|
| 68 |
+
if ( isset( $array['unhook'] ) ) {
|
| 69 |
+
|
| 70 |
foreach( (array) $array['unhook'] as $function ) {
|
| 71 |
+
|
| 72 |
remove_action( $hook, $function );
|
| 73 |
+
|
| 74 |
}
|
| 75 |
+
|
| 76 |
}
|
| 77 |
+
|
| 78 |
}
|
| 79 |
+
|
| 80 |
}
|
| 81 |
|
| 82 |
/**
|
| 86 |
* @since 0.1
|
| 87 |
*/
|
| 88 |
function simplehooks_execute_hook() {
|
| 89 |
+
|
| 90 |
$hook = current_filter();
|
| 91 |
$content = simplehooks_get_option( $hook, 'content' );
|
| 92 |
+
|
| 93 |
+
if( ! $hook || ! $content )
|
| 94 |
+
return;
|
| 95 |
+
|
| 96 |
$shortcodes = simplehooks_get_option( $hook, 'shortcodes' );
|
| 97 |
$php = simplehooks_get_option( $hook, 'php' );
|
| 98 |
+
|
| 99 |
$value = $shortcodes ? do_shortcode( $content ) : $content;
|
| 100 |
+
|
| 101 |
if ( $php )
|
| 102 |
eval( "?>$value<?php " );
|
| 103 |
+
else
|
| 104 |
echo $value;
|
| 105 |
|
| 106 |
}
|
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.
|
| 6 |
-
Tested up to: 3.
|
| 7 |
-
Stable tag: 1.
|
| 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 |
|
|
@@ -101,4 +101,10 @@ The most common request from Genesis users is how to properly modify their foote
|
|
| 101 |
|
| 102 |
= 1.6 =
|
| 103 |
* Increased requirement to Genesis 1.6
|
| 104 |
-
* Fixed bug with things not unhooking
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.2
|
| 6 |
+
Tested up to: 3.2.1
|
| 7 |
+
Stable tag: 1.7.1
|
| 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 |
|
| 101 |
|
| 102 |
= 1.6 =
|
| 103 |
* Increased requirement to Genesis 1.6
|
| 104 |
+
* Fixed bug with things not unhooking
|
| 105 |
+
|
| 106 |
+
= 1.7.1 =
|
| 107 |
+
* Increased requirement to Genesis 1.7.1
|
| 108 |
+
* Fixed display issues in the admin screen
|
| 109 |
+
* Added new hooks to the defaults array
|
| 110 |
+
* Whitespace, standards, and documentation
|
