String locator - Version 2.4.2

Version Description

  • Fixed the option to restore previous search.
  • Fixed respecting text capitalization in previews when doing a non-regex search.
  • Changed capability checks, now works on hosts that maintain updates for their users.
Download this release

Release Info

Developer Clorith
Plugin Icon 128x128 String locator
Version 2.4.2
Comparing to
See all releases

Code changes from version 2.4.1 to 2.4.2

changelog.txt CHANGED
@@ -1,3 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 2.3.1 =
2
  This is a maintenance and security release, with thanks to [RIPS Technologies](https://www.ripstech.com) for the responsible disclosure of several security concerns.
3
 
1
+ = 2.4.1 =
2
+ * Fixed case-sensitive class call, apparently not all PHP versions are equal in how this is treated.
3
+
4
+ = 2.4.0 =
5
+ * Updated the editor screen, to a design which more closely adheres to the WordPress editor styles.
6
+ * Added support for searching files, even if you are not able to edit them.
7
+ * Added support for jumping to not just line number, but also location inside that line.
8
+ * Added alternative to disable loopback checks when saving changes.
9
+ * Improved performance by using transients instead of option entries (lower memory usage overall).
10
+ * Improved handling of errors with links to some documentation when available.
11
+ * Improved the amount of details about the current file that are shown in the editor.
12
+ * Fixed the search results table to look like a normal table when restoring a search.
13
+
14
  = 2.3.1 =
15
  This is a maintenance and security release, with thanks to [RIPS Technologies](https://www.ripstech.com) for the responsible disclosure of several security concerns.
16
 
editor.php CHANGED
@@ -181,7 +181,7 @@ if ( ! $string_locator->failed_edit ) {
181
  <br />
182
  <span class="string-locator-italics">
183
  <?php echo esc_html( str_replace( ABSPATH, '', $file ) ); ?>
184
- <span title="<?php echo esc_attr( sprintf( 'Full file path: %s', $file ) ); ?>" class="dashicons dashicons-editor-help"></span>
185
  </span>
186
  </div>
187
 
@@ -264,6 +264,6 @@ if ( ! $string_locator->failed_edit ) {
264
  <div class="row notice notice-{{ data.type }} inline below-h2 is-dismissible">
265
  {{{ data.message }}}
266
 
267
- <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
268
  </div>
269
  </script>
181
  <br />
182
  <span class="string-locator-italics">
183
  <?php echo esc_html( str_replace( ABSPATH, '', $file ) ); ?>
184
+ <span title="<?php echo esc_attr( sprintf( /* translators: File path. */ esc_html__( 'Full file path: %s', 'string-locator' ), $file ) ); ?>" class="dashicons dashicons-editor-help"></span>
185
  </span>
186
  </div>
187
 
264
  <div class="row notice notice-{{ data.type }} inline below-h2 is-dismissible">
265
  {{{ data.message }}}
266
 
267
+ <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'string-locator' ); ?></span></button>
268
  </div>
269
  </script>
includes/class-string-locator.php CHANGED
@@ -18,7 +18,7 @@ class String_Locator {
18
  * @var int $max_memory_consumption The server-configured max amount of memory a script can use.
19
  */
20
  public $string_locator_language = '';
21
- public $version = '2.4.1';
22
  public $notice = array();
23
  public $failed_edit = false;
24
  private $path_to_use = '';
@@ -330,7 +330,7 @@ class String_Locator {
330
  );
331
 
332
  set_transient( 'string-locator-search-overview', $store );
333
- set_transient( 'string-locator-search-history', array() );
334
 
335
  foreach ( $file_chunks as $count => $file_chunk ) {
336
  set_transient( 'string-locator-search-files-' . $count, $file_chunk );
@@ -549,12 +549,9 @@ class String_Locator {
549
  $response['next_file'] = ( isset( $file_data[ $next_file ] ) ? $file_data[ $next_file ] : '' );
550
 
551
  if ( ! empty( $search_results ) ) {
552
- $history = get_transient( 'string-locator-search-history' );
553
- if ( false === $history ) {
554
- $history = array();
555
- }
556
  $history = array_merge( $history, $search_results );
557
- set_transient( 'string-locator-search-history', serialize( $history ) );
558
  }
559
 
560
  $_POST['filenum'] ++;
@@ -613,7 +610,7 @@ class String_Locator {
613
  </tr>',
614
  $item->stringresult,
615
  ( ! current_user_can( 'edit_themes' ) ? '' : sprintf(
616
- '<span class="edit"><a href="%s" aria-label="Edit">%s</a></span>',
617
  esc_url( $item->editurl ),
618
  // translators: The row-action edit link label.
619
  esc_html__( 'Edit', 'string-locator' )
@@ -865,7 +862,7 @@ class String_Locator {
865
  'search_preparing' => __( 'Preparing search&hellip;', 'string-locator' ),
866
  'search_started' => __( 'Preparations completed, search started&hellip;', 'string-locator' ),
867
  'search_error' => __( 'The above error was returned by your server, for more details please consult your servers error logs.', 'string-locator' ),
868
- 'search_no_results' => __( 'Your search was completed, but no results were found..', 'string-locator' ),
869
  'warning_title' => __( 'Warning', 'string-locator' ),
870
  )
871
  );
@@ -906,7 +903,7 @@ class String_Locator {
906
  }
907
  $page_title = __( 'String Locator', 'string-locator' );
908
  $menu_title = __( 'String Locator', 'string-locator' );
909
- $capability = 'update_core';
910
  $parent_slug = 'tools.php';
911
  $menu_slug = 'string-locator';
912
  $function = array( $this, 'options_page' );
@@ -922,7 +919,7 @@ class String_Locator {
922
  function populate_network_menu() {
923
  $page_title = __( 'String Locator', 'string-locator' );
924
  $menu_title = __( 'String Locator', 'string-locator' );
925
- $capability = 'update_core';
926
  $menu_slug = 'string-locator';
927
  $function = array( $this, 'options_page' );
928
 
@@ -952,7 +949,7 @@ class String_Locator {
952
  if ( isset( $_GET['string-locator-path'] ) && $this->is_valid_location( $_GET['string-locator-path'] ) && current_user_can( 'edit_themes' ) ) {
953
  include_once( dirname( __FILE__ ) . '/../editor.php' );
954
  } else {
955
- include_once( dirname( __FILE__ ) . '/../options.php' );
956
  }
957
  }
958
 
@@ -1245,11 +1242,11 @@ class String_Locator {
1245
  * @param string $slug The plugin/theme slug of the file.
1246
  * @param boolean $regex Should a regex search be performed.
1247
  *
1248
- * @return mixed
1249
  */
1250
  function scan_file( $filename, $string, $location, $type, $slug, $regex = false ) {
1251
  if ( empty( $string ) || ! is_file( $filename ) ) {
1252
- return false;
1253
  }
1254
  $output = array();
1255
  $linenum = 0;
@@ -1366,7 +1363,7 @@ class String_Locator {
1366
  if ( $regex ) {
1367
  $string_preview = preg_replace( preg_replace( '/\/(.+)\//', '/($1)/', $string ), '<strong>$1</strong>', esc_html( $string_preview ) );
1368
  } else {
1369
- $string_preview = str_ireplace( $string, '<strong>' . $string . '</strong>', esc_html( $string_preview ) );
1370
  }
1371
  if ( $string_preview_is_cut ) {
1372
  $string_preview = sprintf(
18
  * @var int $max_memory_consumption The server-configured max amount of memory a script can use.
19
  */
20
  public $string_locator_language = '';
21
+ public $version = '2.4.2';
22
  public $notice = array();
23
  public $failed_edit = false;
24
  private $path_to_use = '';
330
  );
331
 
332
  set_transient( 'string-locator-search-overview', $store );
333
+ update_option( 'string-locator-search-history', array(), false );
334
 
335
  foreach ( $file_chunks as $count => $file_chunk ) {
336
  set_transient( 'string-locator-search-files-' . $count, $file_chunk );
549
  $response['next_file'] = ( isset( $file_data[ $next_file ] ) ? $file_data[ $next_file ] : '' );
550
 
551
  if ( ! empty( $search_results ) ) {
552
+ $history = get_option( 'string-locator-search-history', array() );
 
 
 
553
  $history = array_merge( $history, $search_results );
554
+ update_option( 'string-locator-search-history', $history, false );
555
  }
556
 
557
  $_POST['filenum'] ++;
610
  </tr>',
611
  $item->stringresult,
612
  ( ! current_user_can( 'edit_themes' ) ? '' : sprintf(
613
+ '<span class="edit"><a href="%1$s" aria-label="%2$s">%2$s</a></span>',
614
  esc_url( $item->editurl ),
615
  // translators: The row-action edit link label.
616
  esc_html__( 'Edit', 'string-locator' )
862
  'search_preparing' => __( 'Preparing search&hellip;', 'string-locator' ),
863
  'search_started' => __( 'Preparations completed, search started&hellip;', 'string-locator' ),
864
  'search_error' => __( 'The above error was returned by your server, for more details please consult your servers error logs.', 'string-locator' ),
865
+ 'search_no_results' => __( 'Your search was completed, but no results were found.', 'string-locator' ),
866
  'warning_title' => __( 'Warning', 'string-locator' ),
867
  )
868
  );
903
  }
904
  $page_title = __( 'String Locator', 'string-locator' );
905
  $menu_title = __( 'String Locator', 'string-locator' );
906
+ $capability = 'install_plugins';
907
  $parent_slug = 'tools.php';
908
  $menu_slug = 'string-locator';
909
  $function = array( $this, 'options_page' );
919
  function populate_network_menu() {
920
  $page_title = __( 'String Locator', 'string-locator' );
921
  $menu_title = __( 'String Locator', 'string-locator' );
922
+ $capability = 'install_plugins';
923
  $menu_slug = 'string-locator';
924
  $function = array( $this, 'options_page' );
925
 
949
  if ( isset( $_GET['string-locator-path'] ) && $this->is_valid_location( $_GET['string-locator-path'] ) && current_user_can( 'edit_themes' ) ) {
950
  include_once( dirname( __FILE__ ) . '/../editor.php' );
951
  } else {
952
+ include_once( dirname( __FILE__ ) . '/../search.php' );
953
  }
954
  }
955
 
1242
  * @param string $slug The plugin/theme slug of the file.
1243
  * @param boolean $regex Should a regex search be performed.
1244
  *
1245
+ * @return array
1246
  */
1247
  function scan_file( $filename, $string, $location, $type, $slug, $regex = false ) {
1248
  if ( empty( $string ) || ! is_file( $filename ) ) {
1249
+ return array();
1250
  }
1251
  $output = array();
1252
  $linenum = 0;
1363
  if ( $regex ) {
1364
  $string_preview = preg_replace( preg_replace( '/\/(.+)\//', '/($1)/', $string ), '<strong>$1</strong>', esc_html( $string_preview ) );
1365
  } else {
1366
+ $string_preview = preg_replace( '/(' . $string . ')/i', '<strong>$1</strong>', esc_html( $string_preview ) );
1367
  }
1368
  if ( $string_preview_is_cut ) {
1369
  $string_preview = sprintf(
readme.txt CHANGED
@@ -3,10 +3,10 @@ Contributors: Clorith
3
  Author URI: http://www.clorith.net
4
  Plugin URI: http://wordpress.org/plugins/string-locator/
5
  Donate link: https://www.paypal.me/clorith
6
- Tags: theme, plugin, text, search, find, editor, syntax, highlight
7
  Requires at least: 4.9
8
- Tested up to: 5.4
9
- Stable tag: 2.4.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -45,18 +45,10 @@ When writing your search string, make sure to wrap your search in forward slashe
45
 
46
  == Changelog ==
47
 
48
- = 2.4.1 =
49
- * Fixed case-sensitive class call, apparently not all PHP versions are equal in how this is treated.
50
-
51
- = 2.4.0 =
52
- * Updated the editor screen, to a design which more closely adheres to the WordPress editor styles.
53
- * Added support for searching files, even if you are not able to edit them.
54
- * Added support for jumping to not just line number, but also location inside that line.
55
- * Added alternative to disable loopback checks when saving changes.
56
- * Improved performance by using transients instead of option entries (lower memory usage overall).
57
- * Improved handling of errors with links to some documentation when available.
58
- * Improved the amount of details about the current file that are shown in the editor.
59
- * Fixed the search results table to look like a normal table when restoring a search.
60
 
61
  = Older entries =
62
  See changelog.txt for the version history
3
  Author URI: http://www.clorith.net
4
  Plugin URI: http://wordpress.org/plugins/string-locator/
5
  Donate link: https://www.paypal.me/clorith
6
+ Tags: text, search, find, syntax, highlight
7
  Requires at least: 4.9
8
+ Tested up to: 5.6
9
+ Stable tag: 2.4.2
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
45
 
46
  == Changelog ==
47
 
48
+ = 2.4.2 =
49
+ * Fixed the option to restore previous search.
50
+ * Fixed respecting text capitalization in previews when doing a non-regex search.
51
+ * Changed capability checks, now works on hosts that maintain updates for their users.
 
 
 
 
 
 
 
 
52
 
53
  = Older entries =
54
  See changelog.txt for the version history
resources/js/string-locator-search.js CHANGED
@@ -1 +1 @@
1
- !function(t){var r={};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=r,o.d=function(t,r,e){o.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,r){if(1&r&&(t=o(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(o.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var n in t)o.d(e,n,function(r){return t[r]}.bind(null,n));return e},o.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(r,"a",r),r},o.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},o.p="",o(o.s=3)}([,,,function(t,r,o){t.exports=o(4)},function(t,r){jQuery(document).ready((function(t){var r=!1,o=wp.template("string-locator-search-result");function e(r,o,e){t(".notices").append('<div class="notice notice-'+e+' is-dismissible"><p><strong>'+r+"</strong><br />"+o+"</p></div>")}function n(o,n){r=!1,t(".string-locator-feedback").hide(),e(o,n,"error")}function a(s,c){if(c>=s||!r)return t("#string-locator-feedback-text").html(string_locator.saving_results_string),function(){r=!1,t("#string-locator-feedback-text").text("");var o={action:"string-locator-clean",nonce:string_locator.search_nonce};t.post(string_locator.ajax_url,o,(function(){t(".string-locator-feedback").hide(),t("tbody",".tools_page_string-locator").is(":empty")&&t("tbody",".tools_page_string-locator").html('<tr><td colspan="3">'+string_locator.search_no_results+"</td></tr>")})).fail((function(t,r,o){n(t.status+" "+o,string_locator.search_error)}))}(),!1;var i={action:"string-locator-search",filenum:c,nonce:string_locator.search_nonce};t.post(string_locator.ajax_url,i,(function(r){if(!r.success){if(!1===r.data.continue)return n(string_locator.warning_title,r.data.message),!1;e(string_locator.warning_title,r.data.message,"warning")}void 0!==r.data.search&&(t("#string-locator-search-progress").val(r.data.filenum),t("#string-locator-feedback-text").html(string_locator.search_current_prefix+r.data.next_file),function(r){t(".no-items",".tools_page_string-locator").is(":visible")&&t(".no-items",".tools_page_string-locator").hide();if(Array!==r.constructor)return!1;r.forEach((function(r){if(r)for(var e=0,n=r.length;e<n;e++){var a=r[e];void 0!==a.stringresult&&t("tbody",".tools_page_string-locator").append(o(a))}}))}(r.data.search));var c=r.data.filenum+1;a(s,c)}),"json").fail((function(t,r,o){n(t.status+" "+o,string_locator.search_error)}))}t("#string-locator-search-form").on("submit",(function(o){o.preventDefault(),t("#string-locator-feedback-text").text(string_locator.search_preparing),t(".string-locator-feedback").show(),r=!0,t(".notices").html(""),t("#string-locator-search-progress").removeAttr("value"),t("tbody",".tools_page_string-locator").html("");var s={action:"string-locator-get-directory-structure",directory:t("#string-locator-search").val(),search:t("#string-locator-string").val(),regex:t("#string-locator-regex").is(":checked"),nonce:string_locator.search_nonce};t("table.tools_page_string-locator").show(),t.post(string_locator.ajax_url,s,(function(r){r.success?(t("#string-locator-search-progress").attr("max",r.data.total).val(r.data.current),t("#string-locator-feedback-text").text(string_locator.search_started),a(r.data.total,0)):e(r.data,"alert")}),"json").fail((function(t,r,o){n(t.status+" "+o,string_locator.search_error)}))}))}))}]);
1
+ !function(t){var r={};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=r,o.d=function(t,r,e){o.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,r){if(1&r&&(t=o(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(o.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var n in t)o.d(e,n,function(r){return t[r]}.bind(null,n));return e},o.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(r,"a",r),r},o.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},o.p="",o(o.s=3)}([,,,function(t,r,o){t.exports=o(4)},function(t,r){jQuery(document).ready((function(t){let r=!1;const o=wp.template("string-locator-search-result");function e(r,o,e){t(".notices").append('<div class="notice notice-'+e+' is-dismissible"><p><strong>'+r+"</strong><br />"+o+"</p></div>")}function n(o,n){r=!1,t(".string-locator-feedback").hide(),e(o,n,"error")}function a(s,c){if(c>=s||!r)return t("#string-locator-feedback-text").html(string_locator.saving_results_string),function(){r=!1,t("#string-locator-feedback-text").text("");const o={action:"string-locator-clean",nonce:string_locator.search_nonce};t.post(string_locator.ajax_url,o,(function(){t(".string-locator-feedback").hide(),t("tbody",".tools_page_string-locator").is(":empty")&&t("tbody",".tools_page_string-locator").html('<tr><td colspan="3">'+string_locator.search_no_results+"</td></tr>")})).fail((function(t,r,o){n(t.status+" "+o,string_locator.search_error)}))}(),!1;const i={action:"string-locator-search",filenum:c,nonce:string_locator.search_nonce};t.post(string_locator.ajax_url,i,(function(r){if(!r.success){if(!1===r.data.continue)return n(string_locator.warning_title,r.data.message),!1;e(string_locator.warning_title,r.data.message,"warning")}void 0!==r.data.search&&(t("#string-locator-search-progress").val(r.data.filenum),t("#string-locator-feedback-text").html(string_locator.search_current_prefix+r.data.next_file),function(r){t(".no-items",".tools_page_string-locator").is(":visible")&&t(".no-items",".tools_page_string-locator").hide();if(Array!==r.constructor)return!1;r.forEach((function(r){if(r)for(let e=0,n=r.length;e<n;e++){const n=r[e];void 0!==n.stringresult&&t("tbody",".tools_page_string-locator").append(o(n))}}))}(r.data.search));const c=r.data.filenum+1;a(s,c)}),"json").fail((function(t,r,o){n(t.status+" "+o,string_locator.search_error)}))}t("#string-locator-search-form").on("submit",(function(o){o.preventDefault(),t("#string-locator-feedback-text").text(string_locator.search_preparing),t(".string-locator-feedback").show(),r=!0,t(".notices").html(""),t("#string-locator-search-progress").removeAttr("value"),t("tbody",".tools_page_string-locator").html("");const s={action:"string-locator-get-directory-structure",directory:t("#string-locator-search").val(),search:t("#string-locator-string").val(),regex:t("#string-locator-regex").is(":checked"),nonce:string_locator.search_nonce};t("table.tools_page_string-locator").show(),t.post(string_locator.ajax_url,s,(function(r){r.success?(t("#string-locator-search-progress").attr("max",r.data.total).val(r.data.current),t("#string-locator-feedback-text").text(string_locator.search_started),a(r.data.total,0)):e(r.data,"alert")}),"json").fail((function(t,r,o){n(t.status+" "+o,string_locator.search_error)}))}))}))}]);
resources/js/string-locator.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){o(1),t.exports=o(2)},function(t,e){jQuery(document).ready((function(t){var e;if(!1!==string_locator.CodeMirror&&""!==string_locator.CodeMirror){e=wp.codeEditor.initialize("code-editor",string_locator.CodeMirror);var o=wp.template("string-locator-alert");function r(t){var e=Math.max(document.documentElement.clientHeight,window.innerHeight||0)-89;t.setSize(null,parseInt(e))}t(".string-locator-editor").on("click",".string-locator-edit-goto",(function(o){o.preventDefault(),e.codemirror.scrollIntoView(parseInt(t(this).data("goto-line"))),e.codemirror.setCursor(parseInt(t(this).data("goto-line")-1),t(this).data("goto-linepos"))})),t("body").on("submit","#string-locator-edit-form",(function(e){var r=t("#string-locator-notices");return t.post(string_locator.save_url,t(this).serialize()).always((function(e){void 0===e.notices?r.append(o({type:"error",message:e.responseText})):t.each(e.notices,(function(){r.append(o(this))}))})),e.preventDefault(),!1})),r(e.codemirror),e.codemirror.scrollIntoView(parseInt(string_locator.goto_line)),e.codemirror.setCursor(parseInt(string_locator.goto_line-1),parseInt(string_locator.goto_linepos)),window.addEventListener("resize",r(e.codemirror))}else(e=t("#code-editor")).css("width",t(".string-locator-edit-wrap").width()),e.css("height",parseInt(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-89));t("#string-locator-notices").on("click",".notice-dismiss",(function(e){return t(this).closest(".notice").slideUp(400,"swing",(function(){t(this).remove()})),e.preventDefault(),!1}))}))},function(t,e,o){}]);
1
+ !function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){o(1),t.exports=o(2)},function(t,e){jQuery(document).ready((function(t){let e;if(!1!==string_locator.CodeMirror&&""!==string_locator.CodeMirror){e=wp.codeEditor.initialize("code-editor",string_locator.CodeMirror);const r=wp.template("string-locator-alert");function o(t){const e=Math.max(document.documentElement.clientHeight,window.innerHeight||0)-89;t.setSize(null,parseInt(e))}t(".string-locator-editor").on("click",".string-locator-edit-goto",(function(o){o.preventDefault(),e.codemirror.scrollIntoView(parseInt(t(this).data("goto-line"))),e.codemirror.setCursor(parseInt(t(this).data("goto-line")-1),t(this).data("goto-linepos"))})),t("body").on("submit","#string-locator-edit-form",(function(e){const o=t("#string-locator-notices");return t.post(string_locator.save_url,t(this).serialize()).always((function(e){void 0===e.notices?o.append(r({type:"error",message:e.responseText})):t.each(e.notices,(function(){o.append(r(this))}))})),e.preventDefault(),!1})),o(e.codemirror),e.codemirror.scrollIntoView(parseInt(string_locator.goto_line)),e.codemirror.setCursor(parseInt(string_locator.goto_line-1),parseInt(string_locator.goto_linepos)),window.addEventListener("resize",o(e.codemirror))}else e=t("#code-editor"),e.css("width",t(".string-locator-edit-wrap").width()),e.css("height",parseInt(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-89));t("#string-locator-notices").on("click",".notice-dismiss",(function(e){return t(this).closest(".notice").slideUp(400,"swing",(function(){t(this).remove()})),e.preventDefault(),!1}))}))},function(t,e,o){"use strict";o.r(e)}]);
options.php → search.php RENAMED
@@ -25,7 +25,7 @@ if ( isset( $_GET['restore'] ) ) {
25
  $search_regex = String_Locator::absbool( $restore->regex );
26
  } else {
27
  ?>
28
- <div class="notice notice-large notice-warning">No previous searches could be restored.</div>
29
  <?php
30
  }
31
  }
@@ -89,10 +89,7 @@ if ( isset( $_GET['restore'] ) ) {
89
  <div class="table-wrapper">
90
  <?php
91
  if ( isset( $_GET['restore'] ) ) {
92
- $items = get_transient( 'string-locator-search-history' );
93
- if ( false === $items ) {
94
- $items = array();
95
- }
96
  $items = maybe_unserialize( $items );
97
 
98
  echo String_Locator::prepare_full_table( $items, array( 'restore' ) );
@@ -111,8 +108,8 @@ if ( isset( $_GET['restore'] ) ) {
111
  <div class="row-actions">
112
  <# if ( data.editurl ) { #>
113
  <span class="edit">
114
- <a href="{{ data.editurl }}" aria-label="Edit">
115
- Edit
116
  </a>
117
  </span>
118
  <# } #>
25
  $search_regex = String_Locator::absbool( $restore->regex );
26
  } else {
27
  ?>
28
+ <div class="notice notice-large notice-warning"><?php esc_html_e( 'No previous searches could be restored.', 'string-locator' ); ?></div>
29
  <?php
30
  }
31
  }
89
  <div class="table-wrapper">
90
  <?php
91
  if ( isset( $_GET['restore'] ) ) {
92
+ $items = get_option( 'string-locator-search-history', array() );
 
 
 
93
  $items = maybe_unserialize( $items );
94
 
95
  echo String_Locator::prepare_full_table( $items, array( 'restore' ) );
108
  <div class="row-actions">
109
  <# if ( data.editurl ) { #>
110
  <span class="edit">
111
+ <a href="{{ data.editurl }}" aria-label="<?php esc_attr_e( 'Edit', 'string-locator' ); ?>">
112
+ <?php esc_html_e( 'Edit', 'string-locator' ); ?>
113
  </a>
114
  </span>
115
  <# } #>
string-locator.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: String Locator
4
  * Plugin URI: http://www.clorith.net/wordpress-string-locator/
5
  * Description: Scan through theme and plugin files looking for text strings
6
- * Version: 2.4.1
7
  * Author: Clorith
8
  * Author URI: http://www.clorith.net
9
  * Text Domain: string-locator
3
  * Plugin Name: String Locator
4
  * Plugin URI: http://www.clorith.net/wordpress-string-locator/
5
  * Description: Scan through theme and plugin files looking for text strings
6
+ * Version: 2.4.2
7
  * Author: Clorith
8
  * Author URI: http://www.clorith.net
9
  * Text Domain: string-locator