Changeset 1927703
- Timestamp:
- 08/21/2018 01:08:29 AM (8 years ago)
- Location:
- heartbeat-control
- Files:
-
- 7 edited
- 70 copied
-
tags/1.2.5 (copied) (copied from heartbeat-control/trunk)
-
tags/1.2.5/autoloader.php (modified) (1 diff)
-
tags/1.2.5/composer.lock (copied) (copied from heartbeat-control/trunk/composer.lock)
-
tags/1.2.5/heartbeat-control.php (copied) (copied from heartbeat-control/trunk/heartbeat-control.php) (9 diffs)
-
tags/1.2.5/heartbeat.php (copied) (copied from heartbeat-control/trunk/heartbeat.php) (4 diffs)
-
tags/1.2.5/js/donate-notice.js (copied) (copied from heartbeat-control/trunk/js/donate-notice.js)
-
tags/1.2.5/readme.txt (copied) (copied from heartbeat-control/trunk/readme.txt) (2 diffs)
-
tags/1.2.5/settings.php (modified) (6 diffs)
-
tags/1.2.5/vendor/autoload.php (copied) (copied from heartbeat-control/trunk/vendor/autoload.php)
-
tags/1.2.5/vendor/composer/ClassLoader.php (copied) (copied from heartbeat-control/trunk/vendor/composer/ClassLoader.php)
-
tags/1.2.5/vendor/composer/LICENSE (copied) (copied from heartbeat-control/trunk/vendor/composer/LICENSE)
-
tags/1.2.5/vendor/composer/autoload_real.php (copied) (copied from heartbeat-control/trunk/vendor/composer/autoload_real.php)
-
tags/1.2.5/vendor/composer/installed.json (copied) (copied from heartbeat-control/trunk/vendor/composer/installed.json)
-
tags/1.2.5/vendor/webdevstudios/cmb2/CHANGELOG.md (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/CHANGELOG.md)
-
tags/1.2.5/vendor/webdevstudios/cmb2/CONTRIBUTING.md (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/CONTRIBUTING.md)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-display-rtl.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-display-rtl.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-display-rtl.min.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-display-rtl.min.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-display.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-display.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-display.css.map (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-display.css.map)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-display.min.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-display.min.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-front-rtl.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-front-rtl.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-front-rtl.min.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-front-rtl.min.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-front.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-front.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-front.css.map (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-front.css.map)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-front.min.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-front.min.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-rtl.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-rtl.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2-rtl.min.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2-rtl.min.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2.css.map (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2.css.map)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/cmb2.min.css (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/cmb2.min.css)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/cmb2-display.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/cmb2-display.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/cmb2-front.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/cmb2-front.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/cmb2.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/cmb2.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_collapsible_ui.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_collapsible_ui.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_context_metaboxes.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_context_metaboxes.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_display.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_display.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_front.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_front.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_main_wrap.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_main_wrap.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_misc.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_misc.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_options-page.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_options-page.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_post_metaboxes.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_post_metaboxes.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_sidebar_placements.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_sidebar_placements.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/css/sass/partials/_variables.scss (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/css/sass/partials/_variables.scss)
-
tags/1.2.5/vendor/webdevstudios/cmb2/example-functions.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/example-functions.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_Base.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_Base.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_Boxes.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_Boxes.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_Field.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_Field.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_JS.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_JS.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_Options.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_Options.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_Options_Hookup.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_Options_Hookup.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_Sanitize.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_Sanitize.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_Types.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_Types.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/CMB2_Utils.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/CMB2_Utils.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Base.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Base.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_File.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_File.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_File_Base.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_File_Base.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Taxonomy_Base.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Taxonomy_Base.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Taxonomy_Multicheck_Hierarchical.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Taxonomy_Multicheck_Hierarchical.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Taxonomy_Radio_Hierarchical.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Taxonomy_Radio_Hierarchical.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Text.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Text.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Textarea_Code.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Textarea_Code.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Wysiwyg.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/includes/types/CMB2_Type_Wysiwyg.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/init.php (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/init.php)
-
tags/1.2.5/vendor/webdevstudios/cmb2/js/cmb2-wysiwyg.js (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/js/cmb2-wysiwyg.js)
-
tags/1.2.5/vendor/webdevstudios/cmb2/js/cmb2.js (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/js/cmb2.js)
-
tags/1.2.5/vendor/webdevstudios/cmb2/js/cmb2.min.js (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/js/cmb2.min.js)
-
tags/1.2.5/vendor/webdevstudios/cmb2/languages/cmb2-nl_NL.po (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/languages/cmb2-nl_NL.po)
-
tags/1.2.5/vendor/webdevstudios/cmb2/languages/cmb2-zh_CN.mo (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/languages/cmb2-zh_CN.mo)
-
tags/1.2.5/vendor/webdevstudios/cmb2/languages/cmb2-zh_CN.po (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/languages/cmb2-zh_CN.po)
-
tags/1.2.5/vendor/webdevstudios/cmb2/languages/cmb2.pot (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/languages/cmb2.pot)
-
tags/1.2.5/vendor/webdevstudios/cmb2/readme.txt (copied) (copied from heartbeat-control/trunk/vendor/webdevstudios/cmb2/readme.txt)
-
trunk/autoloader.php (modified) (1 diff)
-
trunk/heartbeat-control.php (modified) (9 diffs)
-
trunk/heartbeat.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/settings.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
heartbeat-control/tags/1.2.5/autoloader.php
r1740215 r1927703 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) { exit; } 2 /** 3 * Contains the autoloader. 4 * 5 * @package Heartbeat_Control 6 */ 3 7 4 function heartbeat_control_autoload( $classname ) { 5 $class = str_replace( '\\', DIRECTORY_SEPARATOR, str_replace( '_', '-', strtolower($classname) ) ); 6 $file_path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $class . '.php'; 7 if ( file_exists( $file_path ) ) { 8 require_once $file_path; 9 } 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; 10 10 } 11 11 12 spl_autoload_register('heartbeat_control_autoload'); 12 /** 13 * Autoloads files based on class names. 14 * 15 * @param string $classname The class name. 16 * 17 * @return void 18 */ 19 function heartbeat_control_autoload( $classname ) { 20 $class = str_replace( '\\', DIRECTORY_SEPARATOR, str_replace( '_', '-', strtolower( $classname ) ) ); 21 $file_path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $class . '.php'; 22 if ( file_exists( $file_path ) ) { 23 require_once $file_path; 24 } 25 } 26 27 // Register the autoloader. 28 spl_autoload_register( 'heartbeat_control_autoload' ); -
heartbeat-control/tags/1.2.5/heartbeat-control.php
r1917302 r1927703 4 4 * Plugin URI: https://jeffmatson.net/heartbeat-control 5 5 * Description: Completely controls the WordPress heartbeat. 6 * Version: 1.2. 46 * Version: 1.2.5 7 7 * Author: Jeff Matson 8 8 * Author URI: http://jeffmatson.net … … 10 10 * Text Domain: heartbeat-control 11 11 * Domain Path: /languages 12 * 13 * @package Heartbeat_Control 12 14 */ 13 15 … … 15 17 16 18 /** 17 * Undocumented class19 * The primary Heartbeat Control class. 18 20 */ 19 21 class Heartbeat_Control { 20 22 21 23 /** 22 * Undocumented variable24 * The current version. 23 25 * 24 26 * @var string 25 27 */ 26 public $version = '1.2. 4';28 public $version = '1.2.5'; 27 29 28 30 /** 29 * Undocumented function31 * Heartbeat_Control Constructor. 30 32 */ 31 33 public function __construct() { … … 38 40 } 39 41 42 /** 43 * Enqueue additional scrips if needed. 44 * 45 * @return void 46 */ 40 47 public function maybe_enqueue_scripts() { 41 48 if ( get_option( 'heartbeat_control_update_notice' ) ) { … … 45 52 } 46 53 54 /** 55 * Register additional plugin dependencies. 56 * 57 * @return void 58 */ 47 59 public function register_dependencies() { 60 // Main plugin autoloader. 48 61 require_once dirname( __FILE__ ) . '/autoloader.php'; 62 63 // Initialize CMB2 for settings pages. 49 64 require_once dirname( __FILE__ ) . '/vendor/webdevstudios/cmb2/init.php'; 50 65 add_action( 'cmb2_admin_init', array( new Settings(), 'init_metaboxes' ) ); 51 66 } 52 67 68 /** 69 * Check the version and update as needed. 70 * 71 * @return void 72 */ 53 73 public function maybe_upgrade() { 54 add_action( 'admin_notices', array( $this, 'heartbeat_control_updated' ) ); 74 if ( ! apply_filters( 'hbc_disable_notice', false ) ) { 75 add_action( 'admin_notices', array( $this, 'heartbeat_control_updated' ) ); 76 } 77 55 78 $db_version = get_option( 'heartbeat_control_version', '1.0' ); 56 79 if ( version_compare( $db_version, $this->version, '<' ) ) { … … 60 83 61 84 /** 62 * U ndocumented function85 * Upgrades the database from older versions. 63 86 * 64 * @param [type] $version87 * @param string $version The current DB version. 65 88 * @return void 66 89 */ … … 81 104 $updated_options['heartbeat_control_location'] = array( '/wp-admin/post.php' ); 82 105 } else { 83 if ( $old_frequency = get_option('heartbeat_frequency') ) {84 $updated_options['heartbeat_control_behavior'] = 'modify';85 $updated_options['heartbeat_control_location'] = array( 'frontend', 'admin', '/wp-admin/post.php' );106 if ( $old_frequency === get_option( 'heartbeat_frequency' ) ) { 107 $updated_options['heartbeat_control_behavior'] = 'modify'; 108 $updated_options['heartbeat_control_location'] = array( 'frontend', 'admin', '/wp-admin/post.php' ); 86 109 $updated_options['heartbeat_control_frequency'] = $old_frequency; 87 110 } … … 101 124 } 102 125 126 /** 127 * Displays the update notice. 128 * 129 * @return void 130 */ 103 131 public function heartbeat_control_updated() { 104 132 if ( get_option( 'heartbeat_control_update_notice' ) ) { 105 ?>133 ?> 106 134 <div id="heartbeat_control_update_notice" class="notice notice-success is-dismissible"> 107 <p><?php _e( 'Heartbeat Control has updated to a new version!', 'heartbeat-control' ); ?></p>108 <p><?php _e( 'Love it? Does it save you money and valuable server resources? Consider <a href="https://paypal.me/JeffMatson">sending me a donation</a>. The plugin is entirely developed in my spare time and every little bit helps to motivate me to add more features and bug fixes.', 'heartbeat-control' ); ?></p>135 <p><?php esc_html_e( 'Heartbeat Control has updated to a new version!', 'heartbeat-control' ); ?></p> 136 <p><?php esc_html_e( 'Love it? Does it save you money and valuable server resources? Consider <a href="https://paypal.me/JeffMatson">sending me a donation</a>. The plugin is entirely developed in my spare time and every little bit helps to motivate me to add more features and bug fixes.', 'heartbeat-control' ); ?></p> 109 137 </div> 110 <?php138 <?php 111 139 } 112 140 } 113 141 142 /** 143 * Dismisses the update notice. 144 * 145 * @return void 146 */ 114 147 public function dismiss_update_notice() { 115 148 delete_option( 'heartbeat_control_update_notice' ); … … 118 151 } 119 152 120 new Heartbeat_Control ;153 new Heartbeat_Control(); -
heartbeat-control/tags/1.2.5/heartbeat.php
r1917325 r1927703 1 1 <?php 2 /** 3 * Contains the Heartbeat_Control\Heartbeat class. 4 * 5 * @package Heartbeat_Control 6 */ 2 7 3 8 namespace Heartbeat_Control; 4 9 10 /** 11 * Primary Hearbeat class. 12 */ 5 13 class Heartbeat { 6 14 15 /** 16 * The current screen being accessed. 17 * 18 * @var string 19 */ 7 20 public $current_screen; 21 22 /** 23 * The current query string being accessed. 24 * 25 * @var string 26 */ 8 27 public $current_query_string; 28 29 /** 30 * Stores heartbeat settings across class methods. 31 * 32 * @var array 33 */ 9 34 public $settings = array(); 10 35 36 /** 37 * Just a regular ole constructor. 38 */ 11 39 public function __construct() { 12 40 13 41 if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { 14 42 $current_url = $_SERVER['REQUEST_URI'] . '?' . $_SERVER['QUERY_STRING']; 15 } else {43 } else { 16 44 $current_url = $_SERVER['REQUEST_URI']; 17 45 } … … 37 65 } 38 66 67 /** 68 * Checks if the current location has a rule. 69 * 70 * @param array $locations Locations that have rules. 71 * 72 * @return bool 73 */ 39 74 public function check_location( $locations ) { 40 75 if ( ! isset( $locations ) || ! is_array( $locations ) ) { … … 53 88 } 54 89 90 /** 91 * Disable the heartbeat, if needed. 92 * 93 * @return void 94 */ 55 95 public function maybe_disable() { 56 96 foreach ( $this->settings as $rule ) { 57 if ( array_key_exists( 'heartbeat_control_behavior', $rule ) && $rule['heartbeat_control_behavior'] === 'disable' ) {97 if ( array_key_exists( 'heartbeat_control_behavior', $rule ) && $rule['heartbeat_control_behavior'] === 'disable' ) { 58 98 59 99 if ( ! array_key_exists( 'heartbeat_control_location', $rule ) ) { … … 70 110 } 71 111 112 /** 113 * Modify the heartbeat, if needed. 114 * 115 * @param array $settings The settings. 116 * 117 * @return array 118 */ 72 119 public function maybe_modify( $settings ) { 73 120 -
heartbeat-control/tags/1.2.5/readme.txt
r1917302 r1927703 5 5 Requires at least: 3.6 6 6 Tested up to: 4.9.7 7 Stable tag: 1.2. 47 Stable tag: 1.2.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 36 36 37 37 == Changelog == 38 = 1.2.5 = 39 * Fixed issue caused by previous version deployment. 40 * Added hbc_disable_notice hook to force dismissal of update notices. 41 * Additional documentation added. 42 * Minor standards adjustments. 43 38 44 = 1.2.4 = 39 45 * Updated CMB2 to 2.4.2. -
heartbeat-control/tags/1.2.5/settings.php
r1823627 r1927703 1 1 <?php 2 /** 3 * Contains the Heartbeat_Control\Settings class. 4 * 5 * @package Heartbeat_Control 6 */ 2 7 3 8 namespace Heartbeat_Control; 4 9 10 /** 11 * Primary settings page class. 12 */ 5 13 class Settings { 6 14 15 /** 16 * Renders the slider field. 17 * 18 * @param [type] $field 19 * @param [type] $field_escaped_value 20 * @param [type] $field_object_id 21 * @param [type] $field_object_type 22 * @param [type] $field_type_object 23 * 24 * @return void 25 */ 7 26 public function render_slider_field( $field, $field_escaped_value, $field_object_id, $field_object_type, $field_type_object ) { 8 27 echo '<div class="slider-field"></div>'; 28 // phpcs:ignore 9 29 echo $field_type_object->input( array( 10 30 'type' => 'hidden', … … 12 32 'readonly' => 'readonly', 13 33 'data-start' => absint( $field_escaped_value ), 14 'data-min' => $field->min(),15 'data-max' => $field->max(),16 'data-step' => $field->step(),34 'data-min' => intval( $field->min() ), 35 'data-max' => intval( $field->max() ), 36 'data-step' => intval( $field->step() ), 17 37 'desc' => '', 18 38 ) ); 19 echo '<span class="slider-field-value-display">' . $field->value_label() .' <span class="slider-field-value-text"></span></span>';39 echo '<span class="slider-field-value-display">' . esc_html( $field->value_label() ) . ' <span class="slider-field-value-text"></span></span>'; 20 40 $field_type_object->_desc( true, true ); 21 41 } 22 42 43 /** 44 * Enqueue scripts on settings pages. 45 * 46 * @param string $hook The settings page slug. 47 * 48 * @return void 49 */ 23 50 public function enqueue_scripts( $hook ) { 24 if ( $hook != 'settings_page_heartbeat_control_settings' ) {51 if ( $hook !== 'settings_page_heartbeat_control_settings' ) { 25 52 return; 26 53 } 27 54 28 wp_enqueue_script( 'heartbeat-control-settings', plugins_url( '/assets/js/bundle.js' , __FILE__ ), array('jquery', 'jquery-ui-slider'), '1.0.0', true);55 wp_enqueue_script( 'heartbeat-control-settings', plugins_url( '/assets/js/bundle.js', __FILE__ ), array( 'jquery', 'jquery-ui-slider' ), '1.0.0', true ); 29 56 wp_localize_script( 'heartbeat-control-settings', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); 30 57 wp_register_style( 'slider_ui', '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css', array(), '1.0' ); … … 32 59 } 33 60 61 /** 62 * Initialize the meta boxes in CMB2. 63 * 64 * @return void 65 */ 34 66 public function init_metaboxes() { 35 67 add_action( 'cmb2_render_slider', array( $this, 'render_slider_field' ), 10, 5 ); … … 40 72 'id' => 'heartbeat_control_settings', 41 73 'title' => __( 'Heartbeat Control Settings', 'heartbeat-control' ), 42 'object_types' => array( 'options-page' , ), // Post type74 'object_types' => array( 'options-page' ), 43 75 'option_key' => 'heartbeat_control_settings', 44 76 'capability' => 'manage_options', … … 59 91 60 92 $cmb->add_group_field( $rule_group, array( 61 'name' => __( 'Heartbeat Behavior', 'heartbeat-control' ),62 'id' => $prefix . 'behavior',63 'type' => 'select',64 'default' => 'allow',65 'classes' => 'heartbeat_behavior',66 'options' => array(67 'allow' => __( 'Allow Heartbeat', 'heartbeat-control' ),68 'disable' => __( 'Disable Heartbeat', 'heartbeat-control' ),69 'modify' => __( 'Modify Heartbeat', 'heartbeat-control' ),93 'name' => __( 'Heartbeat Behavior', 'heartbeat-control' ), 94 'id' => $prefix . 'behavior', 95 'type' => 'select', 96 'default' => 'allow', 97 'classes' => 'heartbeat_behavior', 98 'options' => array( 99 'allow' => __( 'Allow Heartbeat', 'heartbeat-control' ), 100 'disable' => __( 'Disable Heartbeat', 'heartbeat-control' ), 101 'modify' => __( 'Modify Heartbeat', 'heartbeat-control' ), 70 102 ), 71 103 ) ); 72 104 73 105 $cmb->add_group_field( $rule_group, array( 74 'name' => __( 'Locations', 'heartbeat-control' ),75 'id' => $prefix . 'location',76 'type' => 'multicheck',77 'options' => array(78 'admin' => __( 'WordPress Dashboard', 'heartbeat-control' ),79 'frontend' => __( 'Frontend', 'heartbeat-control' ),106 'name' => __( 'Locations', 'heartbeat-control' ), 107 'id' => $prefix . 'location', 108 'type' => 'multicheck', 109 'options' => array( 110 'admin' => __( 'WordPress Dashboard', 'heartbeat-control' ), 111 'frontend' => __( 'Frontend', 'heartbeat-control' ), 80 112 '/wp-admin/post.php' => __( 'Post Editor', 'heartbeat-control' ), 81 113 ), … … 83 115 84 116 $cmb->add_group_field( $rule_group, array( 85 'name' => __( 'Frequency', 'heartbeat-control' ),86 'id' => $prefix . 'frequency',87 'type' => 'slider',88 'min' => '15',89 'step' => '1',90 'max' => '300',117 'name' => __( 'Frequency', 'heartbeat-control' ), 118 'id' => $prefix . 'frequency', 119 'type' => 'slider', 120 'min' => '15', 121 'step' => '1', 122 'max' => '300', 91 123 'default' => '15', 92 124 'classes' => 'heartbeat_frequency', -
heartbeat-control/trunk/autoloader.php
r1740215 r1927703 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) { exit; } 2 /** 3 * Contains the autoloader. 4 * 5 * @package Heartbeat_Control 6 */ 3 7 4 function heartbeat_control_autoload( $classname ) { 5 $class = str_replace( '\\', DIRECTORY_SEPARATOR, str_replace( '_', '-', strtolower($classname) ) ); 6 $file_path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $class . '.php'; 7 if ( file_exists( $file_path ) ) { 8 require_once $file_path; 9 } 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; 10 10 } 11 11 12 spl_autoload_register('heartbeat_control_autoload'); 12 /** 13 * Autoloads files based on class names. 14 * 15 * @param string $classname The class name. 16 * 17 * @return void 18 */ 19 function heartbeat_control_autoload( $classname ) { 20 $class = str_replace( '\\', DIRECTORY_SEPARATOR, str_replace( '_', '-', strtolower( $classname ) ) ); 21 $file_path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $class . '.php'; 22 if ( file_exists( $file_path ) ) { 23 require_once $file_path; 24 } 25 } 26 27 // Register the autoloader. 28 spl_autoload_register( 'heartbeat_control_autoload' ); -
heartbeat-control/trunk/heartbeat-control.php
r1917302 r1927703 4 4 * Plugin URI: https://jeffmatson.net/heartbeat-control 5 5 * Description: Completely controls the WordPress heartbeat. 6 * Version: 1.2. 46 * Version: 1.2.5 7 7 * Author: Jeff Matson 8 8 * Author URI: http://jeffmatson.net … … 10 10 * Text Domain: heartbeat-control 11 11 * Domain Path: /languages 12 * 13 * @package Heartbeat_Control 12 14 */ 13 15 … … 15 17 16 18 /** 17 * Undocumented class19 * The primary Heartbeat Control class. 18 20 */ 19 21 class Heartbeat_Control { 20 22 21 23 /** 22 * Undocumented variable24 * The current version. 23 25 * 24 26 * @var string 25 27 */ 26 public $version = '1.2. 4';28 public $version = '1.2.5'; 27 29 28 30 /** 29 * Undocumented function31 * Heartbeat_Control Constructor. 30 32 */ 31 33 public function __construct() { … … 38 40 } 39 41 42 /** 43 * Enqueue additional scrips if needed. 44 * 45 * @return void 46 */ 40 47 public function maybe_enqueue_scripts() { 41 48 if ( get_option( 'heartbeat_control_update_notice' ) ) { … … 45 52 } 46 53 54 /** 55 * Register additional plugin dependencies. 56 * 57 * @return void 58 */ 47 59 public function register_dependencies() { 60 // Main plugin autoloader. 48 61 require_once dirname( __FILE__ ) . '/autoloader.php'; 62 63 // Initialize CMB2 for settings pages. 49 64 require_once dirname( __FILE__ ) . '/vendor/webdevstudios/cmb2/init.php'; 50 65 add_action( 'cmb2_admin_init', array( new Settings(), 'init_metaboxes' ) ); 51 66 } 52 67 68 /** 69 * Check the version and update as needed. 70 * 71 * @return void 72 */ 53 73 public function maybe_upgrade() { 54 add_action( 'admin_notices', array( $this, 'heartbeat_control_updated' ) ); 74 if ( ! apply_filters( 'hbc_disable_notice', false ) ) { 75 add_action( 'admin_notices', array( $this, 'heartbeat_control_updated' ) ); 76 } 77 55 78 $db_version = get_option( 'heartbeat_control_version', '1.0' ); 56 79 if ( version_compare( $db_version, $this->version, '<' ) ) { … … 60 83 61 84 /** 62 * U ndocumented function85 * Upgrades the database from older versions. 63 86 * 64 * @param [type] $version87 * @param string $version The current DB version. 65 88 * @return void 66 89 */ … … 81 104 $updated_options['heartbeat_control_location'] = array( '/wp-admin/post.php' ); 82 105 } else { 83 if ( $old_frequency = get_option('heartbeat_frequency') ) {84 $updated_options['heartbeat_control_behavior'] = 'modify';85 $updated_options['heartbeat_control_location'] = array( 'frontend', 'admin', '/wp-admin/post.php' );106 if ( $old_frequency === get_option( 'heartbeat_frequency' ) ) { 107 $updated_options['heartbeat_control_behavior'] = 'modify'; 108 $updated_options['heartbeat_control_location'] = array( 'frontend', 'admin', '/wp-admin/post.php' ); 86 109 $updated_options['heartbeat_control_frequency'] = $old_frequency; 87 110 } … … 101 124 } 102 125 126 /** 127 * Displays the update notice. 128 * 129 * @return void 130 */ 103 131 public function heartbeat_control_updated() { 104 132 if ( get_option( 'heartbeat_control_update_notice' ) ) { 105 ?>133 ?> 106 134 <div id="heartbeat_control_update_notice" class="notice notice-success is-dismissible"> 107 <p><?php _e( 'Heartbeat Control has updated to a new version!', 'heartbeat-control' ); ?></p>108 <p><?php _e( 'Love it? Does it save you money and valuable server resources? Consider <a href="https://paypal.me/JeffMatson">sending me a donation</a>. The plugin is entirely developed in my spare time and every little bit helps to motivate me to add more features and bug fixes.', 'heartbeat-control' ); ?></p>135 <p><?php esc_html_e( 'Heartbeat Control has updated to a new version!', 'heartbeat-control' ); ?></p> 136 <p><?php esc_html_e( 'Love it? Does it save you money and valuable server resources? Consider <a href="https://paypal.me/JeffMatson">sending me a donation</a>. The plugin is entirely developed in my spare time and every little bit helps to motivate me to add more features and bug fixes.', 'heartbeat-control' ); ?></p> 109 137 </div> 110 <?php138 <?php 111 139 } 112 140 } 113 141 142 /** 143 * Dismisses the update notice. 144 * 145 * @return void 146 */ 114 147 public function dismiss_update_notice() { 115 148 delete_option( 'heartbeat_control_update_notice' ); … … 118 151 } 119 152 120 new Heartbeat_Control ;153 new Heartbeat_Control(); -
heartbeat-control/trunk/heartbeat.php
r1917325 r1927703 1 1 <?php 2 /** 3 * Contains the Heartbeat_Control\Heartbeat class. 4 * 5 * @package Heartbeat_Control 6 */ 2 7 3 8 namespace Heartbeat_Control; 4 9 10 /** 11 * Primary Hearbeat class. 12 */ 5 13 class Heartbeat { 6 14 15 /** 16 * The current screen being accessed. 17 * 18 * @var string 19 */ 7 20 public $current_screen; 21 22 /** 23 * The current query string being accessed. 24 * 25 * @var string 26 */ 8 27 public $current_query_string; 28 29 /** 30 * Stores heartbeat settings across class methods. 31 * 32 * @var array 33 */ 9 34 public $settings = array(); 10 35 36 /** 37 * Just a regular ole constructor. 38 */ 11 39 public function __construct() { 12 40 13 41 if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { 14 42 $current_url = $_SERVER['REQUEST_URI'] . '?' . $_SERVER['QUERY_STRING']; 15 } else {43 } else { 16 44 $current_url = $_SERVER['REQUEST_URI']; 17 45 } … … 37 65 } 38 66 67 /** 68 * Checks if the current location has a rule. 69 * 70 * @param array $locations Locations that have rules. 71 * 72 * @return bool 73 */ 39 74 public function check_location( $locations ) { 40 75 if ( ! isset( $locations ) || ! is_array( $locations ) ) { … … 53 88 } 54 89 90 /** 91 * Disable the heartbeat, if needed. 92 * 93 * @return void 94 */ 55 95 public function maybe_disable() { 56 96 foreach ( $this->settings as $rule ) { 57 if ( array_key_exists( 'heartbeat_control_behavior', $rule ) && $rule['heartbeat_control_behavior'] === 'disable' ) {97 if ( array_key_exists( 'heartbeat_control_behavior', $rule ) && $rule['heartbeat_control_behavior'] === 'disable' ) { 58 98 59 99 if ( ! array_key_exists( 'heartbeat_control_location', $rule ) ) { … … 70 110 } 71 111 112 /** 113 * Modify the heartbeat, if needed. 114 * 115 * @param array $settings The settings. 116 * 117 * @return array 118 */ 72 119 public function maybe_modify( $settings ) { 73 120 -
heartbeat-control/trunk/readme.txt
r1917302 r1927703 5 5 Requires at least: 3.6 6 6 Tested up to: 4.9.7 7 Stable tag: 1.2. 47 Stable tag: 1.2.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 36 36 37 37 == Changelog == 38 = 1.2.5 = 39 * Fixed issue caused by previous version deployment. 40 * Added hbc_disable_notice hook to force dismissal of update notices. 41 * Additional documentation added. 42 * Minor standards adjustments. 43 38 44 = 1.2.4 = 39 45 * Updated CMB2 to 2.4.2. -
heartbeat-control/trunk/settings.php
r1823627 r1927703 1 1 <?php 2 /** 3 * Contains the Heartbeat_Control\Settings class. 4 * 5 * @package Heartbeat_Control 6 */ 2 7 3 8 namespace Heartbeat_Control; 4 9 10 /** 11 * Primary settings page class. 12 */ 5 13 class Settings { 6 14 15 /** 16 * Renders the slider field. 17 * 18 * @param [type] $field 19 * @param [type] $field_escaped_value 20 * @param [type] $field_object_id 21 * @param [type] $field_object_type 22 * @param [type] $field_type_object 23 * 24 * @return void 25 */ 7 26 public function render_slider_field( $field, $field_escaped_value, $field_object_id, $field_object_type, $field_type_object ) { 8 27 echo '<div class="slider-field"></div>'; 28 // phpcs:ignore 9 29 echo $field_type_object->input( array( 10 30 'type' => 'hidden', … … 12 32 'readonly' => 'readonly', 13 33 'data-start' => absint( $field_escaped_value ), 14 'data-min' => $field->min(),15 'data-max' => $field->max(),16 'data-step' => $field->step(),34 'data-min' => intval( $field->min() ), 35 'data-max' => intval( $field->max() ), 36 'data-step' => intval( $field->step() ), 17 37 'desc' => '', 18 38 ) ); 19 echo '<span class="slider-field-value-display">' . $field->value_label() .' <span class="slider-field-value-text"></span></span>';39 echo '<span class="slider-field-value-display">' . esc_html( $field->value_label() ) . ' <span class="slider-field-value-text"></span></span>'; 20 40 $field_type_object->_desc( true, true ); 21 41 } 22 42 43 /** 44 * Enqueue scripts on settings pages. 45 * 46 * @param string $hook The settings page slug. 47 * 48 * @return void 49 */ 23 50 public function enqueue_scripts( $hook ) { 24 if ( $hook != 'settings_page_heartbeat_control_settings' ) {51 if ( $hook !== 'settings_page_heartbeat_control_settings' ) { 25 52 return; 26 53 } 27 54 28 wp_enqueue_script( 'heartbeat-control-settings', plugins_url( '/assets/js/bundle.js' , __FILE__ ), array('jquery', 'jquery-ui-slider'), '1.0.0', true);55 wp_enqueue_script( 'heartbeat-control-settings', plugins_url( '/assets/js/bundle.js', __FILE__ ), array( 'jquery', 'jquery-ui-slider' ), '1.0.0', true ); 29 56 wp_localize_script( 'heartbeat-control-settings', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); 30 57 wp_register_style( 'slider_ui', '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css', array(), '1.0' ); … … 32 59 } 33 60 61 /** 62 * Initialize the meta boxes in CMB2. 63 * 64 * @return void 65 */ 34 66 public function init_metaboxes() { 35 67 add_action( 'cmb2_render_slider', array( $this, 'render_slider_field' ), 10, 5 ); … … 40 72 'id' => 'heartbeat_control_settings', 41 73 'title' => __( 'Heartbeat Control Settings', 'heartbeat-control' ), 42 'object_types' => array( 'options-page' , ), // Post type74 'object_types' => array( 'options-page' ), 43 75 'option_key' => 'heartbeat_control_settings', 44 76 'capability' => 'manage_options', … … 59 91 60 92 $cmb->add_group_field( $rule_group, array( 61 'name' => __( 'Heartbeat Behavior', 'heartbeat-control' ),62 'id' => $prefix . 'behavior',63 'type' => 'select',64 'default' => 'allow',65 'classes' => 'heartbeat_behavior',66 'options' => array(67 'allow' => __( 'Allow Heartbeat', 'heartbeat-control' ),68 'disable' => __( 'Disable Heartbeat', 'heartbeat-control' ),69 'modify' => __( 'Modify Heartbeat', 'heartbeat-control' ),93 'name' => __( 'Heartbeat Behavior', 'heartbeat-control' ), 94 'id' => $prefix . 'behavior', 95 'type' => 'select', 96 'default' => 'allow', 97 'classes' => 'heartbeat_behavior', 98 'options' => array( 99 'allow' => __( 'Allow Heartbeat', 'heartbeat-control' ), 100 'disable' => __( 'Disable Heartbeat', 'heartbeat-control' ), 101 'modify' => __( 'Modify Heartbeat', 'heartbeat-control' ), 70 102 ), 71 103 ) ); 72 104 73 105 $cmb->add_group_field( $rule_group, array( 74 'name' => __( 'Locations', 'heartbeat-control' ),75 'id' => $prefix . 'location',76 'type' => 'multicheck',77 'options' => array(78 'admin' => __( 'WordPress Dashboard', 'heartbeat-control' ),79 'frontend' => __( 'Frontend', 'heartbeat-control' ),106 'name' => __( 'Locations', 'heartbeat-control' ), 107 'id' => $prefix . 'location', 108 'type' => 'multicheck', 109 'options' => array( 110 'admin' => __( 'WordPress Dashboard', 'heartbeat-control' ), 111 'frontend' => __( 'Frontend', 'heartbeat-control' ), 80 112 '/wp-admin/post.php' => __( 'Post Editor', 'heartbeat-control' ), 81 113 ), … … 83 115 84 116 $cmb->add_group_field( $rule_group, array( 85 'name' => __( 'Frequency', 'heartbeat-control' ),86 'id' => $prefix . 'frequency',87 'type' => 'slider',88 'min' => '15',89 'step' => '1',90 'max' => '300',117 'name' => __( 'Frequency', 'heartbeat-control' ), 118 'id' => $prefix . 'frequency', 119 'type' => 'slider', 120 'min' => '15', 121 'step' => '1', 122 'max' => '300', 91 123 'default' => '15', 92 124 'classes' => 'heartbeat_frequency',
Note: See TracChangeset
for help on using the changeset viewer.