Header Footer Code Manager - Version 1.0.7

Version Description

2018-10-01 * ADDED: Functionality to Exclude Posts and Pages from the Site Wide option.

Download this release

Release Info

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

Code changes from version 1.0.4 to 1.0.7

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.4
7
  * Author: 99robots
8
  * Author URI: https://99robots.com/
9
  * Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
17
  }
18
 
19
  global $hfcm_db_version;
20
- $hfcm_db_version = '1.0';
21
 
22
  // function to create the DB / Options / Defaults
23
  function hfcm_options_install() {
@@ -37,7 +37,9 @@ function hfcm_options_install() {
37
  `display_on` enum('All','s_pages', 's_posts','s_categories','s_custom_posts','s_tags','latest_posts','manual') NOT NULL DEFAULT 'All',
38
  `lp_count` int(10) DEFAULT NULL,
39
  `s_pages` varchar(300) DEFAULT NULL,
 
40
  `s_posts` varchar(1000) DEFAULT NULL,
 
41
  `s_custom_posts` varchar(300) DEFAULT NULL,
42
  `s_categories` varchar(300) DEFAULT NULL,
43
  `s_tags` varchar(300) DEFAULT NULL,
@@ -47,15 +49,45 @@ function hfcm_options_install() {
47
  `created` datetime DEFAULT NULL,
48
  `last_revision_date` datetime DEFAULT NULL,
49
  PRIMARY KEY (`script_id`)
50
- ) $charset_collate; ";
51
 
52
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
53
  dbDelta( $sql );
 
 
 
 
 
 
 
 
 
 
 
54
 
 
 
 
 
 
 
 
 
 
 
55
  add_option( 'hfcm_db_version', $hfcm_db_version );
56
  }
57
  register_activation_hook( __FILE__, 'hfcm_options_install' );
58
 
 
 
 
 
 
 
 
 
 
59
  /*
60
  * Enqueue style-file, if it exists.
61
  */
@@ -209,8 +241,13 @@ function hfcm_add_snippets( $location = '', $content = '' ) {
209
  $out = '';
210
  switch ( $scriptdata->display_on ) {
211
  case 'All':
212
- $out = hfcm_render_snippet( $scriptdata );
213
- break;
 
 
 
 
 
214
  case 'latest_posts':
215
  if ( is_single() ) {
216
  $args = array(
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.7
7
  * Author: 99robots
8
  * Author URI: https://99robots.com/
9
  * Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
17
  }
18
 
19
  global $hfcm_db_version;
20
+ $hfcm_db_version = '1.1';
21
 
22
  // function to create the DB / Options / Defaults
23
  function hfcm_options_install() {
37
  `display_on` enum('All','s_pages', 's_posts','s_categories','s_custom_posts','s_tags','latest_posts','manual') NOT NULL DEFAULT 'All',
38
  `lp_count` int(10) DEFAULT NULL,
39
  `s_pages` varchar(300) DEFAULT NULL,
40
+ `ex_pages` varchar(300) DEFAULT NULL,
41
  `s_posts` varchar(1000) DEFAULT NULL,
42
+ `ex_posts` varchar(300) DEFAULT NULL,
43
  `s_custom_posts` varchar(300) DEFAULT NULL,
44
  `s_categories` varchar(300) DEFAULT NULL,
45
  `s_tags` varchar(300) DEFAULT NULL,
49
  `created` datetime DEFAULT NULL,
50
  `last_revision_date` datetime DEFAULT NULL,
51
  PRIMARY KEY (`script_id`)
52
+ ) $charset_collate; ";
53
 
54
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
55
  dbDelta( $sql );
56
+ $wpdb->show_errors();
57
+ //Check for Exclude Pages
58
+ $column_name = 'ex_pages';
59
+ $checkcolumn = $wpdb->prepare(
60
+ "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ",
61
+ DB_NAME, $table_name, $column_name
62
+ ) ;
63
+ if ( ! empty( $checkcolumn ) ) {
64
+ $altersql = "ALTER TABLE `$table_name` ADD `ex_pages` varchar(300) DEFAULT 0 AFTER `s_pages`";
65
+ $wpdb->query($altersql);
66
+ }
67
 
68
+ //Check for Exclude Posts
69
+ $column_name1 = 'ex_posts';
70
+ $checkcolumn2 = $wpdb->prepare(
71
+ "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ",
72
+ DB_NAME, $table_name, $column_name1
73
+ );
74
+ if ( ! empty( $checkcolumn2 ) ) {
75
+ $altersql = "ALTER TABLE `$table_name` ADD `ex_posts` varchar(300) DEFAULT 0 AFTER `s_posts`";
76
+ $wpdb->query($altersql);
77
+ }
78
  add_option( 'hfcm_db_version', $hfcm_db_version );
79
  }
80
  register_activation_hook( __FILE__, 'hfcm_options_install' );
81
 
82
+ function myplugin_update_db_check() {
83
+ global $hfcm_db_version;
84
+ if ( get_site_option( 'hfcm_db_version' ) != $hfcm_db_version ) {
85
+ hfcm_options_install();
86
+ }
87
+ update_option( 'hfcm_db_version', $hfcm_db_version );
88
+ }
89
+ add_action( 'plugins_loaded', 'myplugin_update_db_check' );
90
+
91
  /*
92
  * Enqueue style-file, if it exists.
93
  */
241
  $out = '';
242
  switch ( $scriptdata->display_on ) {
243
  case 'All':
244
+
245
+ if ( (hfcm_not_empty( $scriptdata, 'ex_pages' ) && is_page( json_decode( $scriptdata->ex_pages ) )) || (hfcm_not_empty( $scriptdata, 'ex_posts' ) && is_single( json_decode( $scriptdata->ex_posts ) )) ){
246
+ $out = '';
247
+ }else{
248
+ $out = hfcm_render_snippet( $scriptdata );
249
+ }
250
+ break;
251
  case 'latest_posts':
252
  if ( is_single() ) {
253
  $args = array(
includes/hfcm-add-edit.php CHANGED
@@ -94,6 +94,54 @@ wp_enqueue_script( 'hfcm_showboxes' );
94
  </tr>
95
  <?php
96
  $pages = get_pages();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  $spagesstyle = ( 's_pages' === $display_on ) ? '' : 'display:none;';
98
  ?>
99
  <tr id="s_pages" style="<?php echo $spagesstyle; ?>">
@@ -199,6 +247,7 @@ wp_enqueue_script( 'hfcm_showboxes' );
199
  <th class="hfcm-th-width"><?php esc_html_e( 'Post Count', '99robots-header-footer-code-manager' ); ?></th>
200
  <td>
201
  <select name="data[lp_count]">
 
202
  <?php
203
  for ( $i = 1; $i <= 20; $i++ ) {
204
  if ( $i === $lp_count ) {
94
  </tr>
95
  <?php
96
  $pages = get_pages();
97
+ $expagesstyle = ( 's_pages' === $display_on ) ? 'display:none;' : '';
98
+ $expostsstyle = ( 's_posts' === $display_on ) ? 'display:none;' : '';
99
+ $excategoriesstyle = 's_categories' === $display_on ? 'display:none;' : '';
100
+ $extagsstyle = 's_tags' === $display_on ? 'display:none;' : '';
101
+ $excpostssstyle = 's_custom_posts' === $display_on ? 'display:none;' : '';
102
+ $exlpcountstyle = 'latest_posts' === $display_on ? 'display:none;' : '';
103
+ ?>
104
+ <tr id="ex_pages" style="<?php echo $expagesstyle . $expostsstyle . $extagsstyle . $excpostssstyle . $excategoriesstyle . $exlpcountstyle; ?>">
105
+ <th class="hfcm-th-width"><?php esc_html_e( 'Exclude Pages', '99robots-header-footer-code-manager' ); ?></th>
106
+ <td>
107
+ <select name="data[ex_pages][]" multiple>
108
+ <?php
109
+ foreach ( $pages as $pdata ) {
110
+ if ( in_array( $pdata->ID, $ex_pages ) ) {
111
+ printf( '<option value="%1$s" selected="selected">%2$s</option>', $pdata->ID, $pdata->post_title );
112
+ } else {
113
+ printf( '<option value="%1$s">%2$s</option>', $pdata->ID, $pdata->post_title );
114
+ }
115
+ }
116
+ ?>
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
144
+ $pages = get_pages();
145
  $spagesstyle = ( 's_pages' === $display_on ) ? '' : 'display:none;';
146
  ?>
147
  <tr id="s_pages" style="<?php echo $spagesstyle; ?>">
247
  <th class="hfcm-th-width"><?php esc_html_e( 'Post Count', '99robots-header-footer-code-manager' ); ?></th>
248
  <td>
249
  <select name="data[lp_count]">
250
+ <?php echo "<option value='{$i}'>{$i}</option>"; ?>
251
  <?php
252
  for ( $i = 1; $i <= 20; $i++ ) {
253
  if ( $i === $lp_count ) {
includes/hfcm-create.php CHANGED
@@ -15,7 +15,9 @@ function hfcm_create() {
15
  $status = '';
16
  $lp_count = 5; // Default value
17
  $s_pages = array();
 
18
  $s_posts = array();
 
19
  $s_custom_posts = array();
20
  $s_categories = array();
21
  $s_tags = array();
15
  $status = '';
16
  $lp_count = 5; // Default value
17
  $s_pages = array();
18
+ $ex_pages = array();
19
  $s_posts = array();
20
+ $ex_posts = array();
21
  $s_custom_posts = array();
22
  $s_categories = array();
23
  $s_tags = array();
includes/hfcm-list.php CHANGED
@@ -25,7 +25,7 @@ class Hfcm_Snippets_List extends WP_List_Table {
25
  *
26
  * @return mixed
27
  */
28
- public static function get_snippets( $per_page = 5, $page_number = 1, $customvar = 'all' ) {
29
 
30
  global $wpdb;
31
  $table_name = "{$wpdb->prefix}hfcm_scripts";
@@ -320,7 +320,7 @@ class Hfcm_Snippets_List extends WP_List_Table {
320
  /** Process bulk action */
321
  $this->process_bulk_action();
322
  $this->views();
323
- $per_page = $this->get_items_per_page( 'snippets_per_page', 5 );
324
  $current_page = $this->get_pagenum();
325
  $total_items = self::record_count();
326
 
25
  *
26
  * @return mixed
27
  */
28
+ public static function get_snippets( $per_page = 10, $page_number = 1, $customvar = 'all' ) {
29
 
30
  global $wpdb;
31
  $table_name = "{$wpdb->prefix}hfcm_scripts";
320
  /** Process bulk action */
321
  $this->process_bulk_action();
322
  $this->views();
323
+ $per_page = $this->get_items_per_page( 'snippets_per_page', 10 );
324
  $current_page = $this->get_pagenum();
325
  $total_items = self::record_count();
326
 
includes/hfcm-request-handler.php CHANGED
@@ -39,7 +39,7 @@ function hfcm_request_handler() {
39
  $table_name, //table
40
  array( 'status' => $status ), //data
41
  array( 'script_id' => $id ), //where
42
- array( '%s', '%s', '%s', '%s', '%s', '%s' ), //data format
43
  array( '%s' ) //where format
44
  );
45
 
@@ -56,7 +56,9 @@ function hfcm_request_handler() {
56
  $lp_count = hfcm_sanitize_text( 'lp_count' );
57
  $status = hfcm_sanitize_text( 'status' );
58
  $s_pages = hfcm_sanitize_array( 's_pages' );
 
59
  $s_posts = hfcm_sanitize_array( 's_posts' );
 
60
  $s_custom_posts = hfcm_sanitize_array( 's_custom_posts', 'string' );
61
  $s_categories = hfcm_sanitize_array( 's_categories' );
62
  $s_tags = hfcm_sanitize_array( 's_tags' );
@@ -85,7 +87,9 @@ function hfcm_request_handler() {
85
  'status' => $status,
86
  'lp_count' => $lp_count,
87
  's_pages' => wp_json_encode( $s_pages ),
 
88
  's_posts' => wp_json_encode( $s_posts ),
 
89
  's_custom_posts' => wp_json_encode( $s_custom_posts ),
90
  's_categories' => wp_json_encode( $s_categories ),
91
  's_tags' => wp_json_encode( $s_tags ),
@@ -102,6 +106,8 @@ function hfcm_request_handler() {
102
  '%s',
103
  '%s',
104
  '%s',
 
 
105
  ),
106
  // Where format
107
  array( '%s' )
@@ -120,7 +126,9 @@ function hfcm_request_handler() {
120
  'status' => $status,
121
  'lp_count' => $lp_count,
122
  's_pages' => wp_json_encode( $s_pages ),
 
123
  's_posts' => wp_json_encode( $s_posts ),
 
124
  's_custom_posts' => wp_json_encode( $s_custom_posts ),
125
  's_categories' => wp_json_encode( $s_categories ),
126
  's_tags' => wp_json_encode( $s_tags ),
@@ -141,6 +149,8 @@ function hfcm_request_handler() {
141
  '%s',
142
  '%s',
143
  '%s',
 
 
144
  )
145
  );
146
  $lastid = $wpdb->insert_id;
@@ -160,6 +170,7 @@ function hfcm_request_handler() {
160
  // Get all selected posts
161
  if ( -1 === $id ) {
162
  $s_posts = array();
 
163
  } else {
164
 
165
  // Select value to update
@@ -201,6 +212,10 @@ function hfcm_request_handler() {
201
 
202
  foreach ( $posts as $pdata ) {
203
 
 
 
 
 
204
  if ( in_array( $pdata->ID, $s_posts ) ) {
205
  $json_output['selected'][] = $pdata->ID;
206
  }
39
  $table_name, //table
40
  array( 'status' => $status ), //data
41
  array( 'script_id' => $id ), //where
42
+ array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ), //data format
43
  array( '%s' ) //where format
44
  );
45
 
56
  $lp_count = hfcm_sanitize_text( 'lp_count' );
57
  $status = hfcm_sanitize_text( 'status' );
58
  $s_pages = hfcm_sanitize_array( 's_pages' );
59
+ $ex_pages = hfcm_sanitize_array( 'ex_pages' );
60
  $s_posts = hfcm_sanitize_array( 's_posts' );
61
+ $ex_posts = hfcm_sanitize_array( 'ex_posts' );
62
  $s_custom_posts = hfcm_sanitize_array( 's_custom_posts', 'string' );
63
  $s_categories = hfcm_sanitize_array( 's_categories' );
64
  $s_tags = hfcm_sanitize_array( 's_tags' );
87
  'status' => $status,
88
  'lp_count' => $lp_count,
89
  's_pages' => wp_json_encode( $s_pages ),
90
+ 'ex_pages' => wp_json_encode( $ex_pages ),
91
  's_posts' => wp_json_encode( $s_posts ),
92
+ 'ex_posts' => wp_json_encode( $ex_posts ),
93
  's_custom_posts' => wp_json_encode( $s_custom_posts ),
94
  's_categories' => wp_json_encode( $s_categories ),
95
  's_tags' => wp_json_encode( $s_tags ),
106
  '%s',
107
  '%s',
108
  '%s',
109
+ '%s',
110
+ '%s',
111
  ),
112
  // Where format
113
  array( '%s' )
126
  'status' => $status,
127
  'lp_count' => $lp_count,
128
  's_pages' => wp_json_encode( $s_pages ),
129
+ 'ex_pages' => wp_json_encode( $ex_pages ),
130
  's_posts' => wp_json_encode( $s_posts ),
131
+ 'ex_posts' => wp_json_encode( $ex_posts ),
132
  's_custom_posts' => wp_json_encode( $s_custom_posts ),
133
  's_categories' => wp_json_encode( $s_categories ),
134
  's_tags' => wp_json_encode( $s_tags ),
149
  '%s',
150
  '%s',
151
  '%s',
152
+ '%s',
153
+ '%s',
154
  )
155
  );
156
  $lastid = $wpdb->insert_id;
170
  // Get all selected posts
171
  if ( -1 === $id ) {
172
  $s_posts = array();
173
+ $ex_posts = array();
174
  } else {
175
 
176
  // Select value to update
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 ) ) {
220
  $json_output['selected'][] = $pdata->ID;
221
  }
includes/hfcm-update.php CHANGED
@@ -27,16 +27,27 @@ function hfcm_update() {
27
  $status = $s->status;
28
  $lp_count = $s->lp_count;
29
  $s_pages = json_decode( $s->s_pages );
 
 
30
 
31
  if ( ! is_array( $s_pages ) ) {
32
  $s_pages = array();
33
  }
34
 
 
 
 
 
35
  $s_posts = json_decode( $s->s_posts );
36
  if ( ! is_array( $s_posts ) ) {
37
  $s_posts = array();
38
  }
39
 
 
 
 
 
 
40
  $s_custom_posts = json_decode( $s->s_custom_posts );
41
  if ( ! is_array( $s_custom_posts ) ) {
42
  $s_custom_posts = array();
@@ -66,7 +77,7 @@ function hfcm_update() {
66
  $display_on = esc_html( $display_on );
67
  $status = esc_html( $status );
68
  $lp_count = esc_html( $lp_count );
69
-
70
  // Notify hfcm-add-edit.php to make necesary changes for update
71
  $update = true;
72
 
27
  $status = $s->status;
28
  $lp_count = $s->lp_count;
29
  $s_pages = json_decode( $s->s_pages );
30
+ $ex_pages = json_decode( $s->ex_pages );
31
+ $ex_posts = json_decode( $s->ex_posts );
32
 
33
  if ( ! is_array( $s_pages ) ) {
34
  $s_pages = array();
35
  }
36
 
37
+ if ( ! is_array( $ex_pages ) ) {
38
+ $ex_pages = array();
39
+ }
40
+
41
  $s_posts = json_decode( $s->s_posts );
42
  if ( ! is_array( $s_posts ) ) {
43
  $s_posts = array();
44
  }
45
 
46
+ $ex_posts = json_decode( $s->ex_posts );
47
+ if ( ! is_array( $ex_posts ) ) {
48
+ $ex_posts = array();
49
+ }
50
+
51
  $s_custom_posts = json_decode( $s->s_custom_posts );
52
  if ( ! is_array( $s_custom_posts ) ) {
53
  $s_custom_posts = array();
77
  $display_on = esc_html( $display_on );
78
  $status = esc_html( $status );
79
  $lp_count = esc_html( $lp_count );
80
+ $i = esc_html( $lp_count );
81
  // Notify hfcm-add-edit.php to make necesary changes for update
82
  $update = true;
83
 
js/showboxes.js CHANGED
@@ -6,38 +6,42 @@ function hfcm_showotherboxes( type ) {
6
  after_content = '<option value="after_content">'+ hfcm_localize.after_content +'</option>',
7
  footer = '<option value="footer">'+ hfcm_localize.footer +'</option>',
8
  all_options = header + before_content + after_content + footer;
9
-
10
- if (type == 's_pages') {
 
 
 
 
11
  jQuery('#s_pages, #locationtr').show();
12
  hfcm_remember_loc( all_options );
13
- jQuery('#s_categories, #s_tags, #c_posttype, #lp_count, #s_posts').hide();
14
  } else if (type == 's_posts') {
15
  jQuery('#s_posts, #locationtr').show();
16
  hfcm_remember_loc( all_options );
17
- jQuery('#s_pages, #s_categories, #s_tags, #c_posttype, #lp_count').hide();
18
  } else if (type == 's_categories') {
19
  jQuery('#s_categories, #locationtr').show();
20
  hfcm_remember_loc( all_options );
21
- jQuery('#s_pages, #s_tags, #c_posttype, #lp_count, #s_posts').hide();
22
  } else if (type == 's_custom_posts') {
23
  jQuery('#c_posttype, #locationtr').show();
24
  hfcm_remember_loc( all_options );
25
- jQuery('#s_categories, #s_tags, #s_pages, #lp_count, #s_posts').hide();
26
  } else if (type == 's_tags') {
27
  hfcm_remember_loc( all_options );
28
  jQuery('#s_tags, #locationtr').show();
29
- jQuery('#s_categories, #s_pages, #c_posttype, #lp_count, #s_posts').hide();
30
  } else if (type == 'latest_posts') {
31
  hfcm_remember_loc( all_options );
32
- jQuery('#s_pages, #s_categories, #s_tags, #c_posttype, #s_posts').hide();
33
  jQuery('#lp_count, #locationtr').show();
34
  } else if (type == 'manual') {
35
- jQuery('#s_pages, #s_categories, #s_tags, #c_posttype, #lp_count, #locationtr, #s_posts').hide();
36
  } else {
37
  hfcm_remember_loc( header + footer );
38
  jQuery('#s_pages, #s_categories, #s_tags, #c_posttype, #lp_count, #s_posts').hide();
39
  jQuery('#locationtr').show();
40
- }
41
  }
42
 
43
  function hfcm_remember_loc( new_html ) {
@@ -56,7 +60,7 @@ jQuery(function($) {
56
  get_posts: true,
57
  security: hfcm_localize.security
58
  };
59
-
60
  $.post(
61
  ajaxurl,
62
  data,
@@ -66,12 +70,12 @@ jQuery(function($) {
66
  options: new_data.posts,
67
  items: new_data.selected
68
  };
69
-
70
  $('#s_posts select').selectize( options );
71
  },
72
  'json' // ajax result format
73
  );
74
 
75
  // selectize all <select multiple> elements
76
- $('#s_pages select, #s_categories select, #c_posttype select, #s_tags select').selectize();
77
- });
6
  after_content = '<option value="after_content">'+ hfcm_localize.after_content +'</option>',
7
  footer = '<option value="footer">'+ hfcm_localize.footer +'</option>',
8
  all_options = header + before_content + after_content + footer;
9
+
10
+ if (type == 'All') {
11
+ jQuery('#ex_pages, #ex_posts, #locationtr').show();
12
+ hfcm_remember_loc( all_options );
13
+ jQuery('#s_categories, #s_pages, #s_tags, #c_posttype, #lp_count, #s_posts').hide();
14
+ }else if (type == 's_pages') {
15
  jQuery('#s_pages, #locationtr').show();
16
  hfcm_remember_loc( all_options );
17
+ jQuery('#s_categories, #s_tags, #ex_pages, #ex_posts, #c_posttype, #lp_count, #s_posts').hide();
18
  } else if (type == 's_posts') {
19
  jQuery('#s_posts, #locationtr').show();
20
  hfcm_remember_loc( all_options );
21
+ jQuery('#s_pages, #s_categories, #ex_pages, #ex_posts, #s_tags, #c_posttype, #lp_count').hide();
22
  } else if (type == 's_categories') {
23
  jQuery('#s_categories, #locationtr').show();
24
  hfcm_remember_loc( all_options );
25
+ jQuery('#s_pages, #s_tags, #c_posttype, #ex_pages, #ex_posts, #lp_count, #s_posts').hide();
26
  } else if (type == 's_custom_posts') {
27
  jQuery('#c_posttype, #locationtr').show();
28
  hfcm_remember_loc( all_options );
29
+ jQuery('#s_categories, #s_tags, #s_pages, #ex_pages, #ex_posts, #lp_count, #s_posts').hide();
30
  } else if (type == 's_tags') {
31
  hfcm_remember_loc( all_options );
32
  jQuery('#s_tags, #locationtr').show();
33
+ jQuery('#s_categories, #s_pages, #c_posttype, #ex_pages, #ex_posts, #lp_count, #s_posts').hide();
34
  } else if (type == 'latest_posts') {
35
  hfcm_remember_loc( all_options );
36
+ jQuery('#s_pages, #s_categories, #s_tags, #ex_pages, #ex_posts, #c_posttype, #s_posts').hide();
37
  jQuery('#lp_count, #locationtr').show();
38
  } else if (type == 'manual') {
39
+ jQuery('#s_pages, #s_categories, #s_tags,#ex_pages, #ex_posts, #c_posttype, #lp_count, #locationtr, #s_posts').hide();
40
  } else {
41
  hfcm_remember_loc( header + footer );
42
  jQuery('#s_pages, #s_categories, #s_tags, #c_posttype, #lp_count, #s_posts').hide();
43
  jQuery('#locationtr').show();
44
+ }
45
  }
46
 
47
  function hfcm_remember_loc( new_html ) {
60
  get_posts: true,
61
  security: hfcm_localize.security
62
  };
63
+
64
  $.post(
65
  ajaxurl,
66
  data,
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
+ });
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.6
6
- Stable tag: 1.0.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://99robots.com
@@ -66,6 +66,9 @@ Header Footer Code Manager by 99 Robots is a easy interface to add snippets to t
66
  * It can accept ANY code snippet (HTML / Javascript / CSS) from any service
67
  * and the list goes on and on...
68
 
 
 
 
69
  > #### Plugin Information
70
  > * [Plugin Site](https://www.99robots.com/header-footer-code-manager)
71
  > * [Plugin Documentation](https://www.99robots.com/docs/header-footer-code-manager)
@@ -78,6 +81,8 @@ Header Footer Code Manager by 99 Robots is a easy interface to add snippets to t
78
  1. Activate the plugin through the 'Plugins' menu in WordPress
79
  1. Go to plugins page to see instructions for shortcode and php template tags
80
 
 
 
81
  == Screenshots ==
82
 
83
  1. Dashboard - All Snippets
@@ -98,6 +103,15 @@ A. If your script is not supported, just let us know and we'll look into it imme
98
 
99
  == Changelog ==
100
 
 
 
 
 
 
 
 
 
 
101
  = 1.0.4 = 2018-05-23
102
  * FIXED: style-admin.css not loading on "Add New Snippet" page.
103
  * FIXED: Post List not loading when selecting "Specific Posts" in "Site Display" under Add New Snippet.
2
  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.7
6
+ Stable tag: 1.0.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://99robots.com
66
  * It can accept ANY code snippet (HTML / Javascript / CSS) from any service
67
  * and the list goes on and on...
68
 
69
+ == MULTISITE NOTE ==
70
+ If using this plugin on a multisite network, please make sure that the plugin is activated on a subsite level only.
71
+
72
  > #### Plugin Information
73
  > * [Plugin Site](https://www.99robots.com/header-footer-code-manager)
74
  > * [Plugin Documentation](https://www.99robots.com/docs/header-footer-code-manager)
81
  1. Activate the plugin through the 'Plugins' menu in WordPress
82
  1. Go to plugins page to see instructions for shortcode and php template tags
83
 
84
+ NOTE: If using this plugin on a multisite network, please make sure that the plugin is activated on a subsite level only.
85
+
86
  == Screenshots ==
87
 
88
  1. Dashboard - All Snippets
103
 
104
  == Changelog ==
105
 
106
+ = 1.0.7 = 2018-10-01
107
+ * ADDED: Functionality to Exclude Posts and Pages from the Site Wide option.
108
+
109
+ = 1.0.6 = 2018-07-10
110
+ * FIXED: Latest Posts dropdown selection always resets to 1 on save / update.
111
+
112
+ = 1.0.5 = 2018-06-14
113
+ * UPDATED: "All Snippets" page to show 10 snippets before pagination starts.
114
+
115
  = 1.0.4 = 2018-05-23
116
  * FIXED: style-admin.css not loading on "Add New Snippet" page.
117
  * FIXED: Post List not loading when selecting "Specific Posts" in "Site Display" under Add New Snippet.