WP Hide Post - Version 2.0.9

Version Description

Release Date - 3 Aug 2017

Fix:A js bug that was causing post editor toolbar not appearing in admin panel Fix: Missing semicolon in a javascript Fix: A bug due to that not all custom post types were being displayed in plugin setting section(reported by William Goodwin)

Download this release

Release Info

Developer rmahfoud
Plugin Icon wp plugin WP Hide Post
Version 2.0.9
Comparing to
See all releases

Code changes from version 2.0.5 to 2.0.9

admin/class-wp-hide-post-admin.php CHANGED
@@ -69,7 +69,7 @@ class wp_hide_post_Admin
69
  $this->wp_hide_post = $wp_hide_post;
70
  $this->version = $version;
71
  $this->license = $license;
72
- $this->post_types = $this->license->is_valid() ? wphp_get_setting('wphp_gen', 'wphp_post_types') : false;
73
  if (!is_array($this->post_types))
74
  {
75
  $this->post_types = array('post', 'page');
@@ -266,7 +266,7 @@ HTML;
266
  'short_label' => 'Feeds',
267
  'description' => '',
268
  ),
269
-
270
  'post_recent' => array(
271
  'label' => wphp_('Hide in Wp Native Recent post widget.'),
272
  'short_label' => 'Recent post',
@@ -608,7 +608,7 @@ HTML;
608
 
609
  public function create_post_type()
610
  {
611
- return ;
612
  register_post_type('acme_product',
613
  array(
614
  'labels' => array(
@@ -644,12 +644,15 @@ HTML;
644
  }
645
  public function register_setting_page()
646
  {
647
- $valid = $this->license->is_valid();
 
648
  wp_hide_post()->settingManager()->register_tab(array('id' => 'wphp_gen', 'title' => 'General'));
649
  $options = array();
650
  foreach ((array) scb_custom_post_types() as $type => $detail)
651
  {
652
- $detail = (array) $detail;
 
 
653
  $options[$type] = array('text' => $detail['labels']->name);
654
  if (!$valid && !$detail['_builtin'])
655
  {
@@ -657,7 +660,7 @@ HTML;
657
  $options[$type]['text'] .= " -- For WP hide post Pro users only";
658
  }
659
  }
660
- $pro = '<div><a target="_blank" style="color:red" href="' . $this->item_url . '">For WP hide post Pro Users only</a></div>';
661
  wp_hide_post()->settingManager()->register_setting_field('wphp_gen', array(
662
  array('name' => 'wphp_post_types',
663
  'label' => wphp_('Allowed custom post types'),
@@ -686,13 +689,13 @@ HTML;
686
  public function admin_menu()
687
  {
688
 
689
- add_submenu_page('options-general.php', wphp_('WP Hide Post'), wphp_("WP Hide Post"), 'manage_options', wp_hide_post()->setting_menu_page(), array(wp_hide_post()->settingManager(), 'plugin_page'));
690
  }
691
  public function register_plugin($licenses)
692
  {
693
- $licenses[] = array('id' => wp_hide_post()->info('id'),
694
  'type' => 'plugin',
695
- 'name' => wp_hide_post()->info('name'),
696
  'label' => 'WP hide Post Plugin',
697
  'options' => array(
698
  'license_text' => array('invalid' => 'Get your WP Hide Post Pro license from here <a href="http://scriptburn.com/wphp" target="_blank">here</a>'),
@@ -795,7 +798,7 @@ HTML;
795
  }
796
  public function display_custom_bulkedit($column_name, $post_type)
797
  {
798
- if ( !wphp_get_setting('wphp_gen', 'show_in_bulkedit'))
799
  {
800
  return;
801
  }
@@ -804,7 +807,7 @@ HTML;
804
  //render our quick edit and bulk edit box
805
  public function display_custom_quickedit($column_name, $post_type)
806
  {
807
- $valid = $this->license->is_valid();
808
 
809
  if (!wphp_get_setting('wphp_gen', 'show_in_quickedit'))
810
  {
@@ -863,7 +866,7 @@ HTML;
863
  $allChecked = $detail['value'];
864
  $index++;
865
  }
866
- $pro = '<div style="padding:10px;padding-bottom:0px"><a target="_blank" style="color:red" href="' . $this->item_url . '">For WP hide post Pro Users only</a></div>';
867
  if ($post_type !== 'page')
868
  {
869
  $pre[] = '<script>(function($)
@@ -888,7 +891,7 @@ HTML;
888
  $post_type_obj = get_post_type_object($post_type);
889
 
890
  $title = sprintf(wphp_('%1$s Visibility'), ucwords($post_type_obj->labels->singular_name));
891
- $html = implode("\n", $pre) . implode("", $html) . ($valid?'':$pro);
892
  require WPHP_PLUGIN_DIR . 'admin/partials/quick-edit-display.php';
893
 
894
  }
@@ -980,7 +983,7 @@ $current_v = isset($_GET['wphp_hidden_on']) ? $_GET['wphp_hidden_on'] : array();
980
  }
981
 
982
  // Filter the posts acording to selected filter in post list select box
983
- public function query_posts_join_custom_filter($join, &$wp_query)
984
  {
985
 
986
  global $wpdb, $pagenow;
@@ -1030,7 +1033,7 @@ $current_v = isset($_GET['wphp_hidden_on']) ? $_GET['wphp_hidden_on'] : array();
1030
  if (!$info)
1031
  {
1032
 
1033
- $obj_license = scb_get_license(wp_hide_post()->info('id'));
1034
  $args['action'] = 'wphp_footer';
1035
  $args['page'] = $page;
1036
  if (is_object($obj_license))
69
  $this->wp_hide_post = $wp_hide_post;
70
  $this->version = $version;
71
  $this->license = $license;
72
+ $this->post_types = is_object($this->license) && $this->license->is_valid() ? wphp_get_setting('wphp_gen', 'wphp_post_types') : false;
73
  if (!is_array($this->post_types))
74
  {
75
  $this->post_types = array('post', 'page');
266
  'short_label' => 'Feeds',
267
  'description' => '',
268
  ),
269
+
270
  'post_recent' => array(
271
  'label' => wphp_('Hide in Wp Native Recent post widget.'),
272
  'short_label' => 'Recent post',
608
 
609
  public function create_post_type()
610
  {
611
+ return;
612
  register_post_type('acme_product',
613
  array(
614
  'labels' => array(
644
  }
645
  public function register_setting_page()
646
  {
647
+
648
+ $valid = is_object($this->license) && $this->license->is_valid();
649
  wp_hide_post()->settingManager()->register_tab(array('id' => 'wphp_gen', 'title' => 'General'));
650
  $options = array();
651
  foreach ((array) scb_custom_post_types() as $type => $detail)
652
  {
653
+
654
+ $detail = (array) $detail;
655
+
656
  $options[$type] = array('text' => $detail['labels']->name);
657
  if (!$valid && !$detail['_builtin'])
658
  {
660
  $options[$type]['text'] .= " -- For WP hide post Pro users only";
661
  }
662
  }
663
+ $pro = '<div><a target="_blank" style="color:red" href="http://scriptburn.com/wphp">For WP hide post Pro Users only</a></div>';
664
  wp_hide_post()->settingManager()->register_setting_field('wphp_gen', array(
665
  array('name' => 'wphp_post_types',
666
  'label' => wphp_('Allowed custom post types'),
689
  public function admin_menu()
690
  {
691
 
692
+ add_submenu_page('options-general.php', wphp_('WP Hide Post'), wphp_('WP Hide Post'), 'manage_options', wp_hide_post()->setting_menu_page(), array(wp_hide_post()->settingManager(), 'plugin_page'));
693
  }
694
  public function register_plugin($licenses)
695
  {
696
+ $licenses[] = array('id' => 'wp-hide-post-pro',
697
  'type' => 'plugin',
698
+ 'name' => 'WP Hide Post Pro',
699
  'label' => 'WP hide Post Plugin',
700
  'options' => array(
701
  'license_text' => array('invalid' => 'Get your WP Hide Post Pro license from here <a href="http://scriptburn.com/wphp" target="_blank">here</a>'),
798
  }
799
  public function display_custom_bulkedit($column_name, $post_type)
800
  {
801
+ if (!wphp_get_setting('wphp_gen', 'show_in_bulkedit'))
802
  {
803
  return;
804
  }
807
  //render our quick edit and bulk edit box
808
  public function display_custom_quickedit($column_name, $post_type)
809
  {
810
+ $valid = is_object($this->license) && $this->license->is_valid();
811
 
812
  if (!wphp_get_setting('wphp_gen', 'show_in_quickedit'))
813
  {
866
  $allChecked = $detail['value'];
867
  $index++;
868
  }
869
+ $pro = '<div style="padding:10px;padding-bottom:0px"><a target="_blank" style="color:red" href="http://scriptburn.com/wphp">For WP hide post Pro Users only</a></div>';
870
  if ($post_type !== 'page')
871
  {
872
  $pre[] = '<script>(function($)
891
  $post_type_obj = get_post_type_object($post_type);
892
 
893
  $title = sprintf(wphp_('%1$s Visibility'), ucwords($post_type_obj->labels->singular_name));
894
+ $html = implode("\n", $pre) . implode("", $html) . ($valid ? '' : $pro);
895
  require WPHP_PLUGIN_DIR . 'admin/partials/quick-edit-display.php';
896
 
897
  }
983
  }
984
 
985
  // Filter the posts acording to selected filter in post list select box
986
+ public function query_posts_join_custom_filter($join, $wp_query)
987
  {
988
 
989
  global $wpdb, $pagenow;
1033
  if (!$info)
1034
  {
1035
 
1036
+ $obj_license = scb_get_license('wp-hide-post-pro');
1037
  $args['action'] = 'wphp_footer';
1038
  $args['page'] = $page;
1039
  if (is_object($obj_license))
admin/conditions.php CHANGED
@@ -39,8 +39,7 @@ if (!function_exists('wphp_is_post_front_post'))
39
  {
40
  function wphp_is_post_front_post()
41
  {
42
-
43
- return is_front_page() || is_home();
44
  }
45
  }
46
  /**
39
  {
40
  function wphp_is_post_front_post()
41
  {
42
+ return is_front_page() || is_home();
 
43
  }
44
  }
45
  /**
admin/js/wp-hide-post-admin.js CHANGED
@@ -13,14 +13,14 @@ var wphp_texts = {
13
  "uncaught_error": "Uncaught Error",
14
  "confirm": "Confirm",
15
  };
16
- $(document).ready(function()
17
  {
18
- $(".chosen-select").chosen(
19
  {
20
  'width': '400px'
21
  });
22
- $("body").append('<div id="dialog-message" style="display:none;z-index:2000" title=""></div>');
23
- modalDialog = $("#dialog-message").dialog(
24
  {
25
  modal: true,
26
  autoOpen: false,
@@ -29,12 +29,12 @@ $(document).ready(function()
29
  {
30
  Ok: function()
31
  {
32
- $(this).dialog("close");
33
  }
34
  }
35
  });
36
  /* quick edit ajax handler */
37
- $('a.editinline1').on('click', function(event)
38
  {
39
  var id = inlineEditPost.getId(this);
40
  set_wphp_hide_on_value(id);
@@ -43,13 +43,13 @@ $(document).ready(function()
43
  var data = {
44
  'action': 'wphp_post_visibility_data',
45
  'post_id': post_id,
46
- 'post_type': $("#posts-filter [name='post_type']").val()
47
  };
48
- var save_btn = $('#edit-' + post_id).find('.inline-edit-save>.save')
49
- $(save_btn).data('label', $(save_btn).val());
50
- $(save_btn).val('loading..');
51
- $(save_btn).attr('disabled', true);
52
- $.ajax(
53
  {
54
  type: "POST",
55
  url: ajaxurl,
@@ -61,21 +61,21 @@ $(document).ready(function()
61
  {
62
  showModalMsg(wphp_texts.error, response.error,
63
  {});
64
- $(save_btn).val($(save_btn).data('label'));
65
- $(save_btn).attr('disabled', false)
66
  }
67
  else
68
  {
69
- $(save_btn).val($(save_btn).data('label'));
70
- $(save_btn).attr('disabled', false);
71
- $('.wphp_quickedit').replaceWith(response.html);
72
  }
73
  },
74
  fail: function(xhr, err)
75
  {
76
- id = $(this)[0].data.split('&')[1].split("=")[1];
77
- $(save_btn).val($(save_btn).data('label'));
78
- $(save_btn).attr('disabled', false)
79
  showModalMsg(wphp_texts.error, formatErrorMessage(xhr, err));
80
  }
81
  });
@@ -87,9 +87,9 @@ function showModalMsg(title, body, option)
87
  option = typeof option === 'undefined' ?
88
  {} : option;
89
  option.title = title
90
- $(modalDialog).dialog(option);
91
- $(modalDialog).html(htmlBody(body));
92
- $(modalDialog).dialog("open");
93
  }
94
 
95
  function htmlBody(body)
@@ -144,22 +144,22 @@ function formatErrorMessage(jqXHR, exception)
144
  function set_wphp_hide_on_value(post_id)
145
  {
146
  // define the edit row
147
- var $edit_row = $('#edit-' + post_id);
148
- var $post_row = $('#post-' + post_id);
149
  // get the data
150
- var $wphp_hide_on = $('.column-wphp_hide_on', $post_row);
151
  // populate the data
152
  //$(':input[name="book_author"]', $edit_row).val($book_author);
153
  //$(':input[name="inprint"]', $edit_row).attr('checked', $inprint);
154
  ///
155
- if (!$('.wphp_hidden_on', $wphp_hide_on).length || !$('.wphp_hide_on_data', $wphp_hide_on).length)
156
  {
157
  return;
158
  }
159
- visibility_values = JSON.parse(decodeURIComponent($('.wphp_hidden_on', $wphp_hide_on).val()));
160
- wphp_hide_on_data = JSON.parse(decodeURIComponent($('.wphp_hide_on_data', $wphp_hide_on).val()));
161
 
162
- $('#' + wphp_hide_on_data['nonce_field'], $edit_row).val(wphp_hide_on_data['nonce_value']);
163
 
164
 
165
  // refresh the quick menu properly
@@ -171,13 +171,13 @@ function set_wphp_hide_on_value(post_id)
171
  {
172
  if (visibility_values[key])
173
  {
174
- $('[name="wphp_visibility_type\[' + key + '\]"]', $edit_row).attr('checked', 'checked');
175
  }
176
- $('[name="wphp_visibility_type_old\[' + key + '\]"]', $edit_row).val(visibility_values[key]);
177
  //jQuery('#myfield').val(fieldValue);
178
  }
179
  }
180
- $(document).ready(function()
181
  {
182
  if(typeof inlineEditPost!=='undefined')
183
  {
@@ -201,15 +201,15 @@ $(document).ready(function()
201
  }
202
  };
203
  }
204
- $('#bulk_edit').on('click', function(event)
205
  {
206
  // define the bulk edit row
207
- var $bulk_row = $('#bulk-edit');
208
  // get the selected post ids that are being edited
209
  var $post_ids = new Array();
210
  $bulk_row.find('#bulk-titles').children().each(function()
211
  {
212
- $post_ids.push($(this).attr('id').replace(/^(ttle)/i, ''));
213
  });
214
  var data = {
215
  'action': 'save_bulk_edit_data',
@@ -223,12 +223,12 @@ $(document).ready(function()
223
  itm_old = wphp_hide_on_data['visibility_name'] + '_old[' + key + ']';
224
  itm_old_esc = wphp_hide_on_data['visibility_name'] + '_old\\[' + key + '\\]';
225
  itm1 = wphp_hide_on_data['visibility_name'] + '\\[' + key + '\\]';
226
- data[itm_name] = $("[ name=" + itm_name_esc + "]").attr('checked') ? 1 : 0;
227
- data[itm_old] = $("[ name=" + itm_old_esc + "]").val();
228
  a = 1;
229
  }
230
  // save the data
231
- $.ajax(
232
  {
233
  url: ajaxurl, // this is a variable that WordPress has already defined for us
234
  type: 'POST',
13
  "uncaught_error": "Uncaught Error",
14
  "confirm": "Confirm",
15
  };
16
+ jQuery(document).ready(function()
17
  {
18
+ jQuery(".chosen-select").chosen(
19
  {
20
  'width': '400px'
21
  });
22
+ jQuery("body").append('<div id="dialog-message" style="display:none;z-index:2000" title=""></div>');
23
+ modalDialog = jQuery("#dialog-message").dialog(
24
  {
25
  modal: true,
26
  autoOpen: false,
29
  {
30
  Ok: function()
31
  {
32
+ jQuery(this).dialog("close");
33
  }
34
  }
35
  });
36
  /* quick edit ajax handler */
37
+ jQuery('a.editinline1').on('click', function(event)
38
  {
39
  var id = inlineEditPost.getId(this);
40
  set_wphp_hide_on_value(id);
43
  var data = {
44
  'action': 'wphp_post_visibility_data',
45
  'post_id': post_id,
46
+ 'post_type': jQuery("#posts-filter [name='post_type']").val()
47
  };
48
+ var save_btn = jQuery('#edit-' + post_id).find('.inline-edit-save>.save');
49
+ jQuery(save_btn).data('label', $(save_btn).val());
50
+ jQuery(save_btn).val('loading..');
51
+ jQuery(save_btn).attr('disabled', true);
52
+ jQuery.ajax(
53
  {
54
  type: "POST",
55
  url: ajaxurl,
61
  {
62
  showModalMsg(wphp_texts.error, response.error,
63
  {});
64
+ jQuery(save_btn).val(jQuery(save_btn).data('label'));
65
+ jQuery(save_btn).attr('disabled', false)
66
  }
67
  else
68
  {
69
+ jQuery(save_btn).val(jQuery(save_btn).data('label'));
70
+ jQuery(save_btn).attr('disabled', false);
71
+ jQuery('.wphp_quickedit').replaceWith(response.html);
72
  }
73
  },
74
  fail: function(xhr, err)
75
  {
76
+ id = jQuery(this)[0].data.split('&')[1].split("=")[1];
77
+ jQuery(save_btn).val(jQuery(save_btn).data('label'));
78
+ jQuery(save_btn).attr('disabled', false)
79
  showModalMsg(wphp_texts.error, formatErrorMessage(xhr, err));
80
  }
81
  });
87
  option = typeof option === 'undefined' ?
88
  {} : option;
89
  option.title = title
90
+ jQuery(modalDialog).dialog(option);
91
+ jQuery(modalDialog).html(htmlBody(body));
92
+ jQuery(modalDialog).dialog("open");
93
  }
94
 
95
  function htmlBody(body)
144
  function set_wphp_hide_on_value(post_id)
145
  {
146
  // define the edit row
147
+ var $edit_row = jQuery('#edit-' + post_id);
148
+ var $post_row = jQuery('#post-' + post_id);
149
  // get the data
150
+ var $wphp_hide_on = jQuery('.column-wphp_hide_on', $post_row);
151
  // populate the data
152
  //$(':input[name="book_author"]', $edit_row).val($book_author);
153
  //$(':input[name="inprint"]', $edit_row).attr('checked', $inprint);
154
  ///
155
+ if (!jQuery('.wphp_hidden_on', $wphp_hide_on).length || !jQuery('.wphp_hide_on_data', $wphp_hide_on).length)
156
  {
157
  return;
158
  }
159
+ visibility_values = JSON.parse(decodeURIComponent(jQuery('.wphp_hidden_on', $wphp_hide_on).val()));
160
+ wphp_hide_on_data = JSON.parse(decodeURIComponent(jQuery('.wphp_hide_on_data', $wphp_hide_on).val()));
161
 
162
+ jQuery('#' + wphp_hide_on_data['nonce_field'], $edit_row).val(wphp_hide_on_data['nonce_value']);
163
 
164
 
165
  // refresh the quick menu properly
171
  {
172
  if (visibility_values[key])
173
  {
174
+ jQuery('[name="wphp_visibility_type\[' + key + '\]"]', $edit_row).attr('checked', 'checked');
175
  }
176
+ jQuery('[name="wphp_visibility_type_old\[' + key + '\]"]', $edit_row).val(visibility_values[key]);
177
  //jQuery('#myfield').val(fieldValue);
178
  }
179
  }
180
+ jQuery(document).ready(function()
181
  {
182
  if(typeof inlineEditPost!=='undefined')
183
  {
201
  }
202
  };
203
  }
204
+ jQuery('#bulk_edit').on('click', function(event)
205
  {
206
  // define the bulk edit row
207
+ var $bulk_row = jQuery('#bulk-edit');
208
  // get the selected post ids that are being edited
209
  var $post_ids = new Array();
210
  $bulk_row.find('#bulk-titles').children().each(function()
211
  {
212
+ $post_ids.push(jQuery(this).attr('id').replace(/^(ttle)/i, ''));
213
  });
214
  var data = {
215
  'action': 'save_bulk_edit_data',
223
  itm_old = wphp_hide_on_data['visibility_name'] + '_old[' + key + ']';
224
  itm_old_esc = wphp_hide_on_data['visibility_name'] + '_old\\[' + key + '\\]';
225
  itm1 = wphp_hide_on_data['visibility_name'] + '\\[' + key + '\\]';
226
+ data[itm_name] = jQuery("[ name=" + itm_name_esc + "]").attr('checked') ? 1 : 0;
227
+ data[itm_old] = jQuery("[ name=" + itm_old_esc + "]").val();
228
  a = 1;
229
  }
230
  // save the data
231
+ jQuery.ajax(
232
  {
233
  url: ajaxurl, // this is a variable that WordPress has already defined for us
234
  type: 'POST',
admin/license/LicenseItem.php CHANGED
@@ -359,6 +359,7 @@ class SCB_LicenseItem
359
  // p_d( $url );
360
  //$this->debug('license', __FUNCTION__ . "-" . __LINE__, $url);
361
  $response = scb_license_manager()->sendGetRequest($url . http_build_query($api_params));
 
362
  }
363
  else
364
  {
359
  // p_d( $url );
360
  //$this->debug('license', __FUNCTION__ . "-" . __LINE__, $url);
361
  $response = scb_license_manager()->sendGetRequest($url . http_build_query($api_params));
362
+
363
  }
364
  else
365
  {
admin/license/LicenseManager.php CHANGED
@@ -21,7 +21,7 @@ class SCB_LicenseManager
21
  }
22
  if (is_null($encrypter))
23
  {
24
- $encrypter = new Encryption();
25
  }
26
  $this->items[$id] = new SCB_LicenseItem($store?$store:'http://scriptburn.com', $item_type, $item_name, $encrypter, $options);
27
  return $this->items[$id];
21
  }
22
  if (is_null($encrypter))
23
  {
24
+ $encrypter = new WP_Hide_Post_Encryption();
25
  }
26
  $this->items[$id] = new SCB_LicenseItem($store?$store:'http://scriptburn.com', $item_type, $item_name, $encrypter, $options);
27
  return $this->items[$id];
admin/license/encryption.php CHANGED
@@ -14,7 +14,7 @@
14
  * - Does HMAC verification of source data
15
  *
16
  */
17
- class Encryption
18
  {
19
 
20
  const METHOD = 'aes-256-cbc';
14
  * - Does HMAC verification of source data
15
  *
16
  */
17
+ class WP_Hide_Post_Encryption
18
  {
19
 
20
  const METHOD = 'aes-256-cbc';
admin/plugin/EDD_SL_Plugin_Updater.php CHANGED
@@ -37,8 +37,11 @@ class EDD_SL_Plugin_Updater
37
  $this->version = $_api_data['version'];
38
 
39
  // Set up hooks.
40
- $this->init();
41
- add_action('admin_init', array($this, 'show_changelog'));
 
 
 
42
  }
43
 
44
  /**
@@ -93,7 +96,7 @@ class EDD_SL_Plugin_Updater
93
  {
94
 
95
  $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
96
- p_l($version_info);
97
  if (false !== $version_info && is_object($version_info) && isset($version_info->new_version))
98
  {
99
 
@@ -104,7 +107,7 @@ class EDD_SL_Plugin_Updater
104
 
105
  $_transient_data->response[$this->name] = $version_info;
106
  $_transient_data->response[$this->name]->plugin = $this->name;
107
- }
108
 
109
  $_transient_data->last_checked = time();
110
  //$_transient_data->last_updated=date( ( 'M j, Y @ H:i' )
37
  $this->version = $_api_data['version'];
38
 
39
  // Set up hooks.
40
+ if (wphp_ispro())
41
+ {
42
+ $this->init();
43
+ add_action('admin_init', array($this, 'show_changelog'));
44
+ }
45
  }
46
 
47
  /**
96
  {
97
 
98
  $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
99
+
100
  if (false !== $version_info && is_object($version_info) && isset($version_info->new_version))
101
  {
102
 
107
 
108
  $_transient_data->response[$this->name] = $version_info;
109
  $_transient_data->response[$this->name]->plugin = $this->name;
110
+ }
111
 
112
  $_transient_data->last_checked = time();
113
  //$_transient_data->last_updated=date( ( 'M j, Y @ H:i' )
admin/plugin/SCB_Item_Helper.php CHANGED
@@ -156,6 +156,7 @@ if (!class_exists('SCB_Item_Helper'))
156
 
157
  public function plugin_updater()
158
  {
 
159
  $plugin_data = $this->plugin_data("", true);
160
  $plugin_conf = array(
161
  'version' => $plugin_data['Version'], // current version number
156
 
157
  public function plugin_updater()
158
  {
159
+
160
  $plugin_data = $this->plugin_data("", true);
161
  $plugin_conf = array(
162
  'version' => $plugin_data['Version'], // current version number
admin/settings/class_settings.php CHANGED
@@ -55,7 +55,7 @@ if (!class_exists('wphp_settings'))
55
  $this->settings_api = new wphp_settingsAPICustom();
56
  add_action('init', array($this, 'init'));
57
 
58
- add_action('admin_init', array($this, 'admin_init'));
59
 
60
  add_action('wp_ajax_manage_license', array($this, 'manage_license'));
61
 
@@ -82,7 +82,7 @@ if (!class_exists('wphp_settings'))
82
  $tab['label'] = isset($tab['label']) ? $tab['label'] : '';
83
  $tab['label'] = $tab['label'] ? $tab['label'] : $tab['title'];
84
  $tab['label'] = $tab['label'] ? $tab['label'] : $tab['id'];
85
- $tab['options'] = isset($tab['options']) ? $tab['options'] : array();
86
  $this->tabs[$tab['id']] = array('id' => $tab['id'], 'title' => $tab['title'], 'label' => $tab['label'], 'options' => $tab['options']);
87
  }
88
  }
@@ -122,8 +122,19 @@ if (!class_exists('wphp_settings'))
122
  unset($settings[$item]);
123
  continue;
124
  }
 
125
  $key = array_search($setting['name'], array_column(isset($this->settings[$tab]) && is_array($this->settings[$tab]) ? $this->settings[$tab] : array(), 'name'));
126
 
 
 
 
 
 
 
 
 
 
 
127
  if ($key !== false)
128
  {
129
  unset($settings[$key]);
@@ -154,6 +165,7 @@ if (!class_exists('wphp_settings'))
154
  $this->license_fields = array();
155
 
156
  $licenses = apply_filters('scb_license_items', $licenses);
 
157
  foreach ($licenses as $license)
158
  {
159
 
@@ -249,6 +261,7 @@ if (!class_exists('wphp_settings'))
249
  }
250
  public function admin_init()
251
  {
 
252
  //set the settings
253
 
254
  $this->settings_api->set_sections($this->get_settings_sections());
@@ -256,7 +269,7 @@ if (!class_exists('wphp_settings'))
256
  //initialize settings
257
  $this->settings_api->admin_init();
258
 
259
- if (isset($_POST['option_page']) && isset($this->all_tabs[$_POST['option_page']]) && isset($this->all_tabs[@$_POST['option_page']]['options']['form']['pre_handler']) && is_callable($this->all_tabs[@$_POST['option_page']]['options']['form']['pre_handler']))
260
  {
261
  $ret = call_user_func_array($this->all_tabs[$_POST['option_page']]['options']['form']['pre_handler'], array($_POST));
262
  }
@@ -329,7 +342,7 @@ if (!class_exists('wphp_settings'))
329
  //p_d($this->all_tabs);
330
  if (isset($_POST['option_page']) && isset($this->all_tabs[$_POST['option_page']]) && is_callable($this->all_tabs[$_POST['option_page']]['options']['form']['post_handler']))
331
  {
332
- $ret = call_user_func_array($this->all_tabs[$_POST['option_page']]['options']['form']['post_handler'], [$_POST]);
333
  }
334
  echo '<div class="wrap">';
335
  $this->settings_api->show_navigation();
@@ -359,7 +372,7 @@ if (!class_exists('wphp_settings'))
359
  header('Content-Type: text/plain');
360
  header('Content-Disposition: attachment; filename="' . $filename . '"');
361
 
362
- // die( wp_strip_all_tags($_POST['scb-sysinfo']);
363
  die(wp_strip_all_tags($_POST['scb-sysinfo']));
364
  }
365
 
55
  $this->settings_api = new wphp_settingsAPICustom();
56
  add_action('init', array($this, 'init'));
57
 
58
+ add_action('admin_init', array($this, 'admin_init'),11);
59
 
60
  add_action('wp_ajax_manage_license', array($this, 'manage_license'));
61
 
82
  $tab['label'] = isset($tab['label']) ? $tab['label'] : '';
83
  $tab['label'] = $tab['label'] ? $tab['label'] : $tab['title'];
84
  $tab['label'] = $tab['label'] ? $tab['label'] : $tab['id'];
85
+ $tab['options'] = isset($tab['options']) ? (is_callable($tab['options']) ? call_user_func_array($tab['options'], array()) : $tab['options']) : array();
86
  $this->tabs[$tab['id']] = array('id' => $tab['id'], 'title' => $tab['title'], 'label' => $tab['label'], 'options' => $tab['options']);
87
  }
88
  }
122
  unset($settings[$item]);
123
  continue;
124
  }
125
+
126
  $key = array_search($setting['name'], array_column(isset($this->settings[$tab]) && is_array($this->settings[$tab]) ? $this->settings[$tab] : array(), 'name'));
127
 
128
+ // check if the setting array index value are callable
129
+ foreach ($setting as $k => $v)
130
+ {
131
+ if (is_callable($setting[$k]))
132
+ {
133
+ $setting[$k] = call_user_func_array($setting[$k], array());
134
+ }
135
+
136
+ }
137
+
138
  if ($key !== false)
139
  {
140
  unset($settings[$key]);
165
  $this->license_fields = array();
166
 
167
  $licenses = apply_filters('scb_license_items', $licenses);
168
+
169
  foreach ($licenses as $license)
170
  {
171
 
261
  }
262
  public function admin_init()
263
  {
264
+
265
  //set the settings
266
 
267
  $this->settings_api->set_sections($this->get_settings_sections());
269
  //initialize settings
270
  $this->settings_api->admin_init();
271
 
272
+ if (isset($_POST['option_page']) && isset($this->all_tabs[$_POST['option_page']]) && isset($this->all_tabs[@$_POST['option_page']]['options']['form']['pre_handler']) && is_callable($this->all_tabs[@$_POST['option_page']]['options']['form']['pre_handler']))
273
  {
274
  $ret = call_user_func_array($this->all_tabs[$_POST['option_page']]['options']['form']['pre_handler'], array($_POST));
275
  }
342
  //p_d($this->all_tabs);
343
  if (isset($_POST['option_page']) && isset($this->all_tabs[$_POST['option_page']]) && is_callable($this->all_tabs[$_POST['option_page']]['options']['form']['post_handler']))
344
  {
345
+ $ret = call_user_func_array($this->all_tabs[$_POST['option_page']]['options']['form']['post_handler'], array($_POST));
346
  }
347
  echo '<div class="wrap">';
348
  $this->settings_api->show_navigation();
372
  header('Content-Type: text/plain');
373
  header('Content-Disposition: attachment; filename="' . $filename . '"');
374
 
375
+ // die( wp_strip_all_tags($_POST['scb-sysinfo']);
376
  die(wp_strip_all_tags($_POST['scb-sysinfo']));
377
  }
378
 
includes/class-wp-hide-post.php CHANGED
@@ -76,8 +76,8 @@ class wp_hide_post
76
  private static $instance;
77
  private $plugin_admin;
78
 
79
- const id = 'wp-hide-post-pro';
80
- const name = 'WP Hide Post Pro';
81
 
82
  private $info;
83
 
@@ -95,7 +95,7 @@ class wp_hide_post
95
  {
96
  if (is_null(self::$instance))
97
  {
98
- self::$instance = new static();
99
  }
100
 
101
  return self::$instance;
@@ -214,7 +214,7 @@ class wp_hide_post
214
  private function define_admin_hooks()
215
  {
216
  $this->loader->add_filter('scb_license_items', $this->plugin_admin, 'register_plugin', 10);
217
- $this->loader->add_action('init', $this->plugin_admin, 'register_setting_page');
218
 
219
  //add our styles
220
  $this->loader->add_action('admin_enqueue_scripts', $this->plugin_admin, 'enqueue_styles');
@@ -407,10 +407,11 @@ class wp_hide_post
407
  }
408
  public function license()
409
  {
410
- return SCB_LicenseManager::getInstance()->item($this->info('id'));
411
  }
412
  public function init()
413
  {
 
414
  $this->settingManager = wphp_settings::instance(array
415
  (
416
  'id' => $this->info('id'),
@@ -418,7 +419,8 @@ class wp_hide_post
418
  'setting_page_name' => $this->setting_menu_page(),
419
  'support_callback' => function ()
420
  {
421
- $obj_license = scb_get_license($this->info('id'));
 
422
  $info = array();
423
  $info['price'] = "0";
424
  if (is_object($obj_license))
@@ -432,8 +434,9 @@ class wp_hide_post
432
  $info['price'] = 1;
433
  if ($info['price'] > 0)
434
  {
 
435
  $output[] = '<h2>For WP hide post Pro users</h2>';
436
- if ($info['key'] && $info['license'] == 'valid')
437
  {
438
  $subject = ("WP hide post Pro Support Request");
439
  $body = "";
@@ -451,22 +454,27 @@ class wp_hide_post
451
  }
452
  $output[] = 'Please submit your questions <a target="_blank" href="https://github.com/scriptburn/wp-hide-post">Here</a>';
453
  echo (implode("\n", $output));
 
 
454
  },
455
  ));
 
 
456
 
457
- scb_license_manager()->add(
458
- $this->info('id'),
459
- null,
460
- 'plugin',
461
- $this->info('name'),
462
- null,
463
- array(
464
- 'license_text' => array('invalid' => 'Get your WP Hide Post Pro license from here <a href="http://scriptburn.com/wphp" target="_blank">here</a>'),
465
- 'store_url' => "http://scriptburn.com",
466
- 'file' => $this->info('file'),
467
-
468
- )
469
- );
 
470
  }
471
  public function define_globals()
472
  {
76
  private static $instance;
77
  private $plugin_admin;
78
 
79
+ const id = 'wp-hide-post';
80
+ const name = 'WP Hide Post';
81
 
82
  private $info;
83
 
95
  {
96
  if (is_null(self::$instance))
97
  {
98
+ self::$instance = new self();
99
  }
100
 
101
  return self::$instance;
214
  private function define_admin_hooks()
215
  {
216
  $this->loader->add_filter('scb_license_items', $this->plugin_admin, 'register_plugin', 10);
217
+ $this->loader->add_action('admin_init', $this->plugin_admin, 'register_setting_page');
218
 
219
  //add our styles
220
  $this->loader->add_action('admin_enqueue_scripts', $this->plugin_admin, 'enqueue_styles');
407
  }
408
  public function license()
409
  {
410
+ return SCB_LicenseManager::getInstance()->item('wp-hide-post-pro');
411
  }
412
  public function init()
413
  {
414
+ p_l("memory_get_usage1-".memory_get_usage(false));
415
  $this->settingManager = wphp_settings::instance(array
416
  (
417
  'id' => $this->info('id'),
419
  'setting_page_name' => $this->setting_menu_page(),
420
  'support_callback' => function ()
421
  {
422
+ p_l("memory_get_usage2-".memory_get_usage(false));
423
+ $obj_license = scb_get_license('wp-hide-post-pro');
424
  $info = array();
425
  $info['price'] = "0";
426
  if (is_object($obj_license))
434
  $info['price'] = 1;
435
  if ($info['price'] > 0)
436
  {
437
+
438
  $output[] = '<h2>For WP hide post Pro users</h2>';
439
+ if (@$info['key'] && @$info['license'] == 'valid')
440
  {
441
  $subject = ("WP hide post Pro Support Request");
442
  $body = "";
454
  }
455
  $output[] = 'Please submit your questions <a target="_blank" href="https://github.com/scriptburn/wp-hide-post">Here</a>';
456
  echo (implode("\n", $output));
457
+ p_l("memory_get_usage3-".memory_get_usage(false));
458
+
459
  },
460
  ));
461
+ if ((defined('WPHP_PRO') && WPHP_PRO) || $this->info('id') == 'wp-hide-post-pro')
462
+ {
463
 
464
+ scb_license_manager()->add(
465
+ 'wp-hide-post-pro',
466
+ null,
467
+ 'plugin',
468
+ 'WP Hide Post Pro',
469
+ null,
470
+ array(
471
+ 'license_text' => array('invalid' => 'Get your WP Hide Post Pro license from here <a href="http://scriptburn.com/wphp" target="_blank">here</a>'),
472
+ 'store_url' => "http://scriptburn.com",
473
+ 'file' => $this->info('file'),
474
+
475
+ )
476
+ );
477
+ }
478
  }
479
  public function define_globals()
480
  {
includes/helpers.php CHANGED
@@ -142,29 +142,38 @@ if (!function_exists('wphp_is_applicable'))
142
 
143
  $types = array_flip(wphp_allowed_post_types());
144
  unset($types['page']);
145
-
146
  $types = array_flip($types);
147
 
148
  if (wphp_is_post_sidebar($wp_query))
149
  {
150
  //p_n(__LINE__);
151
- return true;
152
  }
153
  elseif (is_admin() || is_singular())
154
  {
155
- //p_n(__LINE__);
156
- return false;
 
 
 
 
 
 
 
157
  }
158
  elseif (in_array($item_type, $types) || $item_type == 'page')
159
  {
160
  // p_n(__LINE__);
161
- return true;
162
  }
163
  else
164
  {
165
- // p_n(__LINE__);
166
- return false;
167
  }
 
 
168
 
169
  }
170
  }
@@ -433,9 +442,13 @@ function scb_custom_post_types($output = 'objects')
433
  $types = (array) get_post_types($args, $output, $operator);
434
  unset($types['revision']);
435
  unset($types['nav_menu_item']);
436
- unset($types['attachment']);
437
-
438
 
439
  return empty($types) || !is_array($types) ? array() : $types;
440
 
441
  }
 
 
 
 
 
142
 
143
  $types = array_flip(wphp_allowed_post_types());
144
  unset($types['page']);
145
+ $ret = 0;
146
  $types = array_flip($types);
147
 
148
  if (wphp_is_post_sidebar($wp_query))
149
  {
150
  //p_n(__LINE__);
151
+ $ret = 1;
152
  }
153
  elseif (is_admin() || is_singular())
154
  {
155
+
156
+ if (@is_front_page())
157
+ {
158
+ $ret = 4;
159
+ }
160
+ else
161
+ {
162
+ $ret = 0;
163
+ }
164
  }
165
  elseif (in_array($item_type, $types) || $item_type == 'page')
166
  {
167
  // p_n(__LINE__);
168
+ $ret = 2;
169
  }
170
  else
171
  {
172
+
173
+ $ret = 0;
174
  }
175
+ p_l($ret);
176
+ return $ret;
177
 
178
  }
179
  }
442
  $types = (array) get_post_types($args, $output, $operator);
443
  unset($types['revision']);
444
  unset($types['nav_menu_item']);
445
+ unset($types['attachment']);
 
446
 
447
  return empty($types) || !is_array($types) ? array() : $types;
448
 
449
  }
450
+
451
+ function wphp_ispro()
452
+ {
453
+ return (defined('WPHP_PRO') && WPHP_PRO) || wp_hide_post()->info('id') == 'wp-hide-post-pro';
454
+ }
public/class-wp-hide-post-public.php CHANGED
@@ -177,7 +177,7 @@ class wp_hide_post_Public
177
  * @param $where
178
  * @return unknown_type
179
  */
180
- public function query_posts_where($where, &$wp_query = null)
181
  {
182
 
183
  p_l("called: wphp_query_posts_where");
177
  * @param $where
178
  * @return unknown_type
179
  */
180
+ public function query_posts_where($where, $wp_query = null)
181
  {
182
 
183
  p_l("called: wphp_query_posts_where");
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://scriptburn.com/wp-hide-post/
4
  Tags: SEO,hide,show,visbility,privacy,customization,sitemap,filter
5
  Requires at least: 2.6
6
  Tested up to: 4.8
7
- Stable tag: 2.0.5
8
  License: GPLv2
9
 
10
  Control the visibility of items on your blog by making posts/pages hidden on some parts , while still visible in other parts and search engines.
@@ -111,9 +111,34 @@ Ditto. It will be deleted. If you had any existing data (if you had it active be
111
 
112
  == Changelog ==
113
 
114
- = 2.0.5 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  *Release Date - 31 July 2017*
116
- * Fix an issue for wordpress install which are running < PHP5.5.5
 
 
 
 
 
 
 
 
117
 
118
  = 2.0.4 =
119
  *Release Date - 30 July 2017*
4
  Tags: SEO,hide,show,visbility,privacy,customization,sitemap,filter
5
  Requires at least: 2.6
6
  Tested up to: 4.8
7
+ Stable tag: 2.0.9
8
  License: GPLv2
9
 
10
  Control the visibility of items on your blog by making posts/pages hidden on some parts , while still visible in other parts and search engines.
111
 
112
  == Changelog ==
113
 
114
+ = 2.0.9 =
115
+ *Release Date - 3 Aug 2017*
116
+
117
+ Fix:A js bug that was causing post editor toolbar not appearing in admin panel
118
+ Fix: Missing semicolon in a javascript
119
+ Fix: A bug due to that not all custom post types were being displayed in plugin setting section(reported by William Goodwin)
120
+
121
+ = 2.0.8 =
122
+ *Release Date - 1 Aug 2017*
123
+
124
+ Fix: A bug that was causing recurse error and throwing fatal error
125
+
126
+ = 2.0.7 =
127
+ *Release Date - 31 July 2017*
128
+
129
+ Fix: Renamed some conflicting class name with other plugins
130
+
131
+ = 2.0.6 =
132
  *Release Date - 31 July 2017*
133
+
134
+ Fix: post was not hiding if the static page was selected as homepage
135
+ Fix: Compatibility with old version of PHP
136
+
137
+
138
+ = 2.0.5 =
139
+ *Release Date - 30 July 2017*
140
+
141
+ Fix: Compatibility with old version of PHP
142
 
143
  = 2.0.4 =
144
  *Release Date - 30 July 2017*
wp-hide-post.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: WP Hide Post
17
  * Plugin URI: http://scriptburn.com/wp-hide-post
18
  * Description: Control the visibility of items on your blog by making posts/pages hidden on some parts , while still visible in other parts and search engines.
19
- * Version: 2.0.5
20
  * Author: scriptburn.com
21
  * Author URI: http://www.scriptburn.com
22
  * License: GPL-2.0+
@@ -31,7 +31,7 @@ if (!defined('WPINC'))
31
  die;
32
  }
33
  global $table_prefix;
34
- define('WPHP_VER', "2.0.3");
35
  define('WPHP_DB_VER', "2");
36
 
37
  define('WPHP_PLUGIN_DIR', __DIR__ . "/");
16
  * Plugin Name: WP Hide Post
17
  * Plugin URI: http://scriptburn.com/wp-hide-post
18
  * Description: Control the visibility of items on your blog by making posts/pages hidden on some parts , while still visible in other parts and search engines.
19
+ * Version: 2.0.9
20
  * Author: scriptburn.com
21
  * Author URI: http://www.scriptburn.com
22
  * License: GPL-2.0+
31
  die;
32
  }
33
  global $table_prefix;
34
+ define('WPHP_VER', "2.0.9");
35
  define('WPHP_DB_VER', "2");
36
 
37
  define('WPHP_PLUGIN_DIR', __DIR__ . "/");