Header Footer Code Manager - Version 1.0.9

Version Description

2018-10-09 * UPDATED: Code Optimization

Download this release

Release Info

Developer 99robots
Plugin Icon 128x128 Header Footer Code Manager
Version 1.0.9
Comparing to
See all releases

Code changes from version 1.0.8 to 1.0.9

99robots-header-footer-code-manager.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Header Footer Code Manager
4
  * Plugin URI: https://99robots.com/products
5
  * Description: Header Footer Code Manager by 99 Robots is a quick and simple way for you to add tracking code snippets, conversion pixels, or other scripts required by third party services for analytics, tracking, marketing, or chat functions. For detailed documentation, please visit the plugin's <a href="https://99robots.com/"> official page</a>.
6
- * Version: 1.0.8
7
  * Author: 99robots
8
  * Author URI: https://99robots.com/
9
  * Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -57,7 +57,7 @@ function hfcm_options_install() {
57
  }
58
  register_activation_hook( __FILE__, 'hfcm_options_install' );
59
 
60
- function myplugin_update_db_check() {
61
  global $hfcm_db_version;
62
  global $wpdb;
63
  $table_name = $wpdb->prefix . 'hfcm_scripts';
@@ -88,7 +88,7 @@ function myplugin_update_db_check() {
88
  }
89
  update_option( 'hfcm_db_version', $hfcm_db_version );
90
  }
91
- add_action( 'plugins_loaded', 'myplugin_update_db_check' );
92
 
93
  /*
94
  * Enqueue style-file, if it exists.
3
  * Plugin Name: Header Footer Code Manager
4
  * Plugin URI: https://99robots.com/products
5
  * Description: Header Footer Code Manager by 99 Robots is a quick and simple way for you to add tracking code snippets, conversion pixels, or other scripts required by third party services for analytics, tracking, marketing, or chat functions. For detailed documentation, please visit the plugin's <a href="https://99robots.com/"> official page</a>.
6
+ * Version: 1.0.9
7
  * Author: 99robots
8
  * Author URI: https://99robots.com/
9
  * Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
57
  }
58
  register_activation_hook( __FILE__, 'hfcm_options_install' );
59
 
60
+ function hfcm_db_update_check() {
61
  global $hfcm_db_version;
62
  global $wpdb;
63
  $table_name = $wpdb->prefix . 'hfcm_scripts';
88
  }
89
  update_option( 'hfcm_db_version', $hfcm_db_version );
90
  }
91
+ add_action( 'plugins_loaded', 'hfcm_db_update_check' );
92
 
93
  /*
94
  * Enqueue style-file, if it exists.
images/ajax-loader.gif ADDED
Binary file
includes/hfcm-add-edit.php CHANGED
@@ -117,27 +117,12 @@ wp_enqueue_script( 'hfcm_showboxes' );
117
  </select>
118
  </td>
119
  </tr>
120
- <?php
121
- $exposts = get_posts(array(
122
- 'orderby' => 'menu_order',
123
- 'sort_order' => 'asc',
124
- 'numberposts'=>-1
125
- ) );
126
- ?>
127
  <tr id="ex_posts" style="<?php echo $expagesstyle . $expostsstyle . $extagsstyle . $excpostssstyle . $excategoriesstyle . $exlpcountstyle; ?>">
128
  <th class="hfcm-th-width"><?php esc_html_e( 'Exclude Posts', '99robots-header-footer-code-manager' ); ?></th>
129
  <td>
130
- <select name="data[ex_posts][]" multiple>
131
- <?php
132
- foreach ( $exposts as $pdata ) {
133
- if ( in_array( $pdata->ID, $ex_posts ) ) {
134
- printf( '<option value="%1$s" selected="selected">%2$s</option>', $pdata->ID, $pdata->post_title );
135
- } else {
136
- printf( '<option value="%1$s">%2$s</option>', $pdata->ID, $pdata->post_title );
137
- }
138
- }
139
- ?>
140
- </select>
141
  </td>
142
  </tr>
143
  <?php
117
  </select>
118
  </td>
119
  </tr>
 
 
 
 
 
 
 
120
  <tr id="ex_posts" style="<?php echo $expagesstyle . $expostsstyle . $extagsstyle . $excpostssstyle . $excategoriesstyle . $exlpcountstyle; ?>">
121
  <th class="hfcm-th-width"><?php esc_html_e( 'Exclude Posts', '99robots-header-footer-code-manager' ); ?></th>
122
  <td>
123
+ <select class="nnr-wraptext" name="data[ex_posts][]" multiple>
124
+ <option disabled></option>
125
+ </select> <img id="loader" src="<?php echo plugins_url('images/ajax-loader.gif', dirname( __FILE__ ));?>">
 
 
 
 
 
 
 
 
126
  </td>
127
  </tr>
128
  <?php
includes/hfcm-request-handler.php CHANGED
@@ -181,6 +181,14 @@ function hfcm_request_handler() {
181
  $s_posts = array();
182
  }
183
  }
 
 
 
 
 
 
 
 
184
  }
185
 
186
  // Get all posts
@@ -208,12 +216,13 @@ function hfcm_request_handler() {
208
  $json_output = array(
209
  'selected' => array(),
210
  'posts' => array(),
 
211
  );
212
 
213
  foreach ( $posts as $pdata ) {
214
 
215
  if ( in_array( $pdata->ID, $ex_posts ) ) {
216
- $json_output['selected'][] = $pdata->ID;
217
  }
218
 
219
  if ( in_array( $pdata->ID, $s_posts ) ) {
181
  $s_posts = array();
182
  }
183
  }
184
+
185
+ $script_ex = $wpdb->get_results( $wpdb->prepare( "SELECT ex_posts from $table_name where script_id=%s", $id ) );
186
+ foreach ( $script_ex as $s ) {
187
+ $ex_posts = json_decode( $s->ex_posts );
188
+ if ( ! is_array( $ex_posts ) ) {
189
+ $ex_posts = array();
190
+ }
191
+ }
192
  }
193
 
194
  // Get all posts
216
  $json_output = array(
217
  'selected' => array(),
218
  'posts' => array(),
219
+ 'excluded' => array(),
220
  );
221
 
222
  foreach ( $posts as $pdata ) {
223
 
224
  if ( in_array( $pdata->ID, $ex_posts ) ) {
225
+ $json_output['excluded'][] = $pdata->ID;
226
  }
227
 
228
  if ( in_array( $pdata->ID, $s_posts ) ) {
js/showboxes.js CHANGED
@@ -51,7 +51,7 @@ function hfcm_remember_loc( new_html ) {
51
  }
52
 
53
  // init selectize.js
54
-
55
  jQuery(function($) {
56
 
57
  var data = {
@@ -68,14 +68,20 @@ jQuery(function($) {
68
  var options = {
69
  plugins: ['remove_button'],
70
  options: new_data.posts,
71
- items: new_data.selected
72
  };
73
-
74
  $('#s_posts select').selectize( options );
 
 
 
 
 
 
 
75
  },
76
- 'json' // ajax result format
77
  );
78
-
79
  // selectize all <select multiple> elements
80
- $('#s_pages select, #s_categories select, #c_posttype select, #s_tags select, #ex_pages select, #ex_posts select').selectize();
81
  });
51
  }
52
 
53
  // init selectize.js
54
+ jQuery('#loader').show();
55
  jQuery(function($) {
56
 
57
  var data = {
68
  var options = {
69
  plugins: ['remove_button'],
70
  options: new_data.posts,
71
+ items: new_data.selected,
72
  };
73
+ $('#loader').hide();
74
  $('#s_posts select').selectize( options );
75
+ var options = {
76
+ plugins: ['remove_button'],
77
+ options: new_data.posts,
78
+ items: new_data.excluded
79
+ };
80
+ $('#loader').hide();
81
+ $('#ex_posts select').selectize( options );
82
  },
83
+ 'json', // ajax result format
84
  );
 
85
  // selectize all <select multiple> elements
86
+ $('#s_pages select, #s_categories select, #c_posttype select, #s_tags select, #ex_pages select').selectize();
87
  });
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: 99robots, charliepatel
3
  Tags: header, footer, code manager, snippet, functions.php, tracking, google analytics, adsense, verification, pixel
4
  Requires at least: 4.0
5
  Tested up to: 4.9.8
6
- Stable tag: 1.0.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://99robots.com
@@ -103,6 +103,9 @@ A. If your script is not supported, just let us know and we'll look into it imme
103
 
104
  == Changelog ==
105
 
 
 
 
106
  = 1.0.8 = 2018-10-04
107
  * FIXED: Updated obsolete code causing errors.
108
 
3
  Tags: header, footer, code manager, snippet, functions.php, tracking, google analytics, adsense, verification, pixel
4
  Requires at least: 4.0
5
  Tested up to: 4.9.8
6
+ Stable tag: 1.0.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://99robots.com
103
 
104
  == Changelog ==
105
 
106
+ = 1.0.9 = 2018-10-09
107
+ * UPDATED: Code Optimization
108
+
109
  = 1.0.8 = 2018-10-04
110
  * FIXED: Updated obsolete code causing errors.
111