Heartbeat Control - Version 1.2.1

Version Description

Download this release

Release Info

Developer JeffMatson
Plugin Icon 128x128 Heartbeat Control
Version 1.2.1
Comparing to
See all releases

Code changes from version 1.2 to 1.2.1

heartbeat-control-actions.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- $heartbeat_location = get_option('heartbeat_location');
3
- $heartbeat_frequency = get_option('heartbeat_frequency');
4
-
5
- if ( $heartbeat_location == 'disable-heartbeat-everywhere') {
6
-
7
- add_action( 'init', 'stop_heartbeat', 1 );
8
-
9
- function stop_heartbeat() {
10
-
11
- wp_deregister_script('heartbeat');
12
-
13
- }
14
-
15
- } elseif ($heartbeat_location == 'disable-heartbeat-dashboard') {
16
-
17
- add_action( 'init', 'stop_heartbeat', 1 );
18
-
19
- function stop_heartbeat() {
20
- global $pagenow;
21
-
22
- if ( $pagenow == 'index.php' )
23
- wp_deregister_script('heartbeat');
24
- }
25
-
26
- } elseif ($heartbeat_location == 'allow-heartbeat-post-edit') {
27
-
28
- add_action( 'init', 'stop_heartbeat', 1 );
29
-
30
- function stop_heartbeat() {
31
- global $pagenow;
32
-
33
- if ( $pagenow != 'post.php' && $pagenow != 'post-new.php' )
34
- wp_deregister_script('heartbeat');
35
- }
36
-
37
- }
38
-
39
- if ( is_numeric( $heartbeat_frequency ) ) {
40
- function heartbeat_frequency( $settings ) {
41
- global $heartbeat_frequency;
42
- $settings['interval'] = $heartbeat_frequency;
43
- return $settings;
44
- }
45
-
46
- add_filter( 'heartbeat_settings', 'heartbeat_frequency' );
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
heartbeat-control-donate.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- if( get_option( 'heartbeat_control_donate_dismissed' == '1' ) ) {
4
- add_action( 'admin_notices', 'heartbeat_control_donate_notice' );
5
- }
6
-
7
- function heartbeat_control_donate_notice() {
8
- ?>
9
- <div class="notice heartbeat-control-donate is-dismissible" >
10
- <p>Thanks for using Heartbeat Control! As I don't make any money from this plugin, please consider <a href="http://jeffmatson.net/donate">donating</a> to help keep Heartbeat Control updated.</p>
11
- </div>
12
- <?php
13
- }
14
-
15
- add_action( 'admin_enqueue_scripts', 'heartbeat_control_assets' );
16
-
17
- function heartbeat_control_assets() {
18
- wp_enqueue_script( 'heartbeat-control-donate-notice', plugins_url( '/js/donate-notice.js', __FILE__ ), array( 'jquery' ), '1.0', true );
19
- }
20
-
21
- function heartbeat_control_dismiss_donate() {
22
- update_option( 'heartbeat_control_donate_dismissed', '1' );
23
- }
24
- add_action( 'wp_ajax_heartbeat_control_dismiss_donate', 'heartbeat_control_dismiss_donate' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
heartbeat-control-menu.php DELETED
@@ -1,95 +0,0 @@
1
- <?php
2
-
3
- add_action( 'admin_menu', 'heartbeat_control_menu_page' );
4
- /**
5
- * heartbeat_control_menu function.
6
- *
7
- * @access public
8
- * @return void
9
- */
10
- function heartbeat_control_menu_page() {
11
-
12
- add_submenu_page(
13
- 'options-general.php',
14
- __( 'Heartbeat Control', 'heartbeat-control' ),
15
- __( 'Heartbeat Control', 'heartbeat-control' ),
16
- 'manage_options',
17
- 'heartbeat-control',
18
- 'heartbeat_control_menu',
19
- 99
20
- );
21
- }
22
-
23
- function heartbeat_control_menu() {
24
-
25
- $directory = plugin_dir_path( __FILE__ );
26
-
27
- require_once $directory . '/heartbeat-control-options.php';
28
- ?>
29
-
30
- <?php if ( isset( $_POST['heartbeat_location'] ) && in_array( $_POST['heartbeat_location'], $heartbeat_control_options ) ) {
31
- update_option( 'heartbeat_location', $_POST['heartbeat_location'] );
32
- }?>
33
-
34
- <?php if ( isset( $_POST['heartbeat_frequency'] ) && in_array( $_POST['heartbeat_frequency'], $heartbeat_frequency_options ) ) {
35
- update_option( 'heartbeat_frequency', $_POST['heartbeat_frequency'] );
36
- }?>
37
-
38
- <div class="wrap">
39
-
40
- <h1> Heartbeat Control configuration </h1>
41
-
42
- <form method="post" action="<?php admin_url( 'tools.php?page=heartbeat-control' ); ?>">
43
-
44
- <table class="form-table">
45
- <tr valign="top">
46
- <th scope="row">Control heartbeat locations:</th>
47
-
48
- <?php $heartbeat_setting = get_option( 'heartbeat_location' ) ?>
49
-
50
- <td>
51
- <label>
52
- <select name="heartbeat_location">
53
-
54
- <?php foreach ( $heartbeat_control_options as $options => $setting_value ) : ?>
55
-
56
- <option value="<?php echo $setting_value ?>"
57
- <?php selected( $setting_value, $heartbeat_setting ); ?>>
58
- <?php echo esc_html( $options ); ?>
59
- </option>
60
-
61
- <?php endforeach; ?>
62
-
63
- </select>
64
- </label>
65
- </td>
66
- </tr>
67
- <tr valign="top">
68
- <th scope="row">Override heartbeat frequency:</th>
69
-
70
- <?php $heartbeat_frequency = get_option( 'heartbeat_frequency' ) ?>
71
-
72
- <td>
73
- <label>
74
- <select name="heartbeat_frequency">
75
-
76
- <?php foreach ( $heartbeat_frequency_options as $options => $setting_value ) : ?>
77
-
78
- <option value="<?php echo $setting_value ?>"
79
- <?php selected( $setting_value, $heartbeat_frequency ); ?>>
80
- <?php echo esc_html( $options ); ?>
81
- </option>
82
-
83
- <?php endforeach; ?>
84
-
85
- </select>
86
- </label>
87
- </td>
88
- </tr>
89
- </table>
90
- <?php submit_button(); ?>
91
- </form>
92
- <p><strong>Did this plugin help you? Please consider donating to help keep Heartbeat Control updated:</strong></p>
93
- <a class="button button-primary" href="http://jeffmatson.net/donate">Donate</a>
94
- <?php
95
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
heartbeat-control-options.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- $heartbeat_control_options = array (
3
- 'Use default' => 'use-default',
4
- 'Disable everywhere' => 'disable-heartbeat-everywhere',
5
- 'Disable on dashboard page' => 'disable-heartbeat-dashboard',
6
- 'Allow only on post edit pages' => 'allow-heartbeat-post-edit',
7
- );
8
-
9
- $heartbeat_frequency_options = array(
10
- 'Use default' => 'default',
11
- '15 seconds' => '15',
12
- '20 seconds' => '20',
13
- '25 seconds' => '25',
14
- '30 seconds' => '30',
15
- '35 seconds' => '35',
16
- '40 seconds' => '40',
17
- '45 seconds' => '45',
18
- '50 seconds' => '50',
19
- '60 seconds' => '60',
20
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
heartbeat-control.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Heartbeat Control
4
  * Plugin URI: https://jeffmatson.net/heartbeat-control
5
  * Description: Completely controls the WordPress heartbeat.
6
- * Version: 1.2
7
  * Author: Jeff Matson
8
  * Author URI: http://jeffmatson.net
9
  * License: GPL2
@@ -21,7 +21,7 @@ class Heartbeat_Control {
21
  *
22
  * @var string
23
  */
24
- public $version = '1.2';
25
 
26
  /**
27
  * Undocumented function
3
  * Plugin Name: Heartbeat Control
4
  * Plugin URI: https://jeffmatson.net/heartbeat-control
5
  * Description: Completely controls the WordPress heartbeat.
6
+ * Version: 1.2.1
7
  * Author: Jeff Matson
8
  * Author URI: http://jeffmatson.net
9
  * License: GPL2
21
  *
22
  * @var string
23
  */
24
+ public $version = '1.2.1';
25
 
26
  /**
27
  * Undocumented function
settings.php CHANGED
@@ -28,6 +28,7 @@ class Settings {
28
  wp_enqueue_script('heartbeat-control-settings', plugins_url( '/assets/js/bundle.js' , __FILE__ ), array('jquery', 'jquery-ui-slider'), '1.0.0', true);
29
  wp_localize_script( 'heartbeat-control-settings', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
30
  wp_register_style( 'slider_ui', '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css', array(), '1.0' );
 
31
  }
32
 
33
  public function init_metaboxes() {
28
  wp_enqueue_script('heartbeat-control-settings', plugins_url( '/assets/js/bundle.js' , __FILE__ ), array('jquery', 'jquery-ui-slider'), '1.0.0', true);
29
  wp_localize_script( 'heartbeat-control-settings', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
30
  wp_register_style( 'slider_ui', '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css', array(), '1.0' );
31
+ wp_enqueue_style( 'slider_ui' );
32
  }
33
 
34
  public function init_metaboxes() {
trunk/heartbeat-control.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Heartbeat Control
4
  * Plugin URI: https://jeffmatson.net/heartbeat-control
5
  * Description: Completely controls the WordPress heartbeat.
6
- * Version: 1.2
7
  * Author: Jeff Matson
8
  * Author URI: http://jeffmatson.net
9
  * License: GPL2
@@ -21,7 +21,7 @@ class Heartbeat_Control {
21
  *
22
  * @var string
23
  */
24
- public $version = '1.2';
25
 
26
  /**
27
  * Undocumented function
3
  * Plugin Name: Heartbeat Control
4
  * Plugin URI: https://jeffmatson.net/heartbeat-control
5
  * Description: Completely controls the WordPress heartbeat.
6
+ * Version: 1.2.1
7
  * Author: Jeff Matson
8
  * Author URI: http://jeffmatson.net
9
  * License: GPL2
21
  *
22
  * @var string
23
  */
24
+ public $version = '1.2.1';
25
 
26
  /**
27
  * Undocumented function
trunk/readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.patreon.com/JeffMatson
4
  Tags: heartbeat, admin-ajax, server resources, heartbeat control, heartbeat api, performance, debugging, javascript
5
  Requires at least: 3.6
6
  Tested up to: 4.8.2
7
- Stable tag: 1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -35,6 +35,9 @@ All options are located within Settings > Heartbeat Control.
35
  If you commonly leave your WordPress admin up for long periods of time, especially while writing or editing a post, the repeated POST requests can cause high resource usage. To avoid this, the heartbeat can be modified or even disabled to lower your server resource usage.
36
 
37
  == Changelog ==
 
 
 
38
  = 1.2 =
39
  * Added conditional logic.
40
  * Multiple actions can now be performed.
4
  Tags: heartbeat, admin-ajax, server resources, heartbeat control, heartbeat api, performance, debugging, javascript
5
  Requires at least: 3.6
6
  Tested up to: 4.8.2
7
+ Stable tag: 1.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
35
  If you commonly leave your WordPress admin up for long periods of time, especially while writing or editing a post, the repeated POST requests can cause high resource usage. To avoid this, the heartbeat can be modified or even disabled to lower your server resource usage.
36
 
37
  == Changelog ==
38
+ = 1.2.1 =
39
+ * Fixed issue that would cause some users to not see the modification slider.
40
+
41
  = 1.2 =
42
  * Added conditional logic.
43
  * Multiple actions can now be performed.
trunk/settings.php CHANGED
@@ -28,6 +28,7 @@ class Settings {
28
  wp_enqueue_script('heartbeat-control-settings', plugins_url( '/assets/js/bundle.js' , __FILE__ ), array('jquery', 'jquery-ui-slider'), '1.0.0', true);
29
  wp_localize_script( 'heartbeat-control-settings', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
30
  wp_register_style( 'slider_ui', '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css', array(), '1.0' );
 
31
  }
32
 
33
  public function init_metaboxes() {
28
  wp_enqueue_script('heartbeat-control-settings', plugins_url( '/assets/js/bundle.js' , __FILE__ ), array('jquery', 'jquery-ui-slider'), '1.0.0', true);
29
  wp_localize_script( 'heartbeat-control-settings', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
30
  wp_register_style( 'slider_ui', '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css', array(), '1.0' );
31
+ wp_enqueue_style( 'slider_ui' );
32
  }
33
 
34
  public function init_metaboxes() {