Version Description
(2022-11-02) = * Fixed a bug causing certain setups to be unable to perform searches when editing would also be unavailable. * Fixed a bug causing certain plugins to prevent the search results list from being displayed properly. * Verified compatibility with WordPress 6.1
Download this release
Release Info
Developer | Clorith |
Plugin | String locator |
Version | 2.6.1 |
Comparing to | |
See all releases |
Code changes from version 2.6.0 to 2.6.1
- includes/Base/class-rest.php +1 -1
- includes/Extension/SQL/views/editor/sql.php +1 -1
- includes/REST/class-directory-structure.php +5 -0
- includes/REST/class-search.php +5 -0
- includes/class-string-locator.php +15 -1
- readme.txt +6 -1
- string-locator.php +2 -2
- views/editors/default.php +1 -1
- views/search.php +21 -1
includes/Base/class-rest.php
CHANGED
@@ -28,7 +28,7 @@ class REST extends \WP_REST_Controller {
|
|
28 |
* @return bool
|
29 |
*/
|
30 |
public function permission_callback() {
|
31 |
-
return current_user_can( String_Locator::$
|
32 |
}
|
33 |
|
34 |
}
|
28 |
* @return bool
|
29 |
*/
|
30 |
public function permission_callback() {
|
31 |
+
return current_user_can( String_Locator::$search_capability );
|
32 |
}
|
33 |
|
34 |
}
|
includes/Extension/SQL/views/editor/sql.php
CHANGED
@@ -76,7 +76,7 @@ $editor_content = $row->{ $_GET['sql-column'] };
|
|
76 |
<div id="string-locator-notices">
|
77 |
<div class="row notice notice-error inline below-h2 hide-if-js">
|
78 |
<p>
|
79 |
-
<?php esc_html_e( 'The editor requires
|
80 |
</p>
|
81 |
</div>
|
82 |
|
76 |
<div id="string-locator-notices">
|
77 |
<div class="row notice notice-error inline below-h2 hide-if-js">
|
78 |
<p>
|
79 |
+
<?php esc_html_e( 'The editor requires JavaScript to be enabled before it can be used.', 'string-locator' ); ?>
|
80 |
</p>
|
81 |
</div>
|
82 |
|
includes/REST/class-directory-structure.php
CHANGED
@@ -4,6 +4,7 @@ namespace StringLocator\REST;
|
|
4 |
|
5 |
use StringLocator\Base\REST;
|
6 |
use StringLocator\Directory_Iterator;
|
|
|
7 |
|
8 |
class Directory_Structure extends REST {
|
9 |
|
@@ -25,6 +26,10 @@ class Directory_Structure extends REST {
|
|
25 |
);
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
28 |
public function get_structure( \WP_REST_Request $request ) {
|
29 |
$short_circuit = apply_filters( 'string_locator_directory_iterator_short_circuit', array(), $request );
|
30 |
|
4 |
|
5 |
use StringLocator\Base\REST;
|
6 |
use StringLocator\Directory_Iterator;
|
7 |
+
use StringLocator\String_Locator;
|
8 |
|
9 |
class Directory_Structure extends REST {
|
10 |
|
26 |
);
|
27 |
}
|
28 |
|
29 |
+
public function permission_callback() {
|
30 |
+
return current_user_can( String_Locator::$search_capability );
|
31 |
+
}
|
32 |
+
|
33 |
public function get_structure( \WP_REST_Request $request ) {
|
34 |
$short_circuit = apply_filters( 'string_locator_directory_iterator_short_circuit', array(), $request );
|
35 |
|
includes/REST/class-search.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
namespace StringLocator\REST;
|
4 |
|
5 |
use StringLocator\Base\REST;
|
|
|
6 |
|
7 |
class Search extends REST {
|
8 |
|
@@ -24,6 +25,10 @@ class Search extends REST {
|
|
24 |
);
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
27 |
public function perform_search( \WP_REST_Request $request ) {
|
28 |
$handler = new \StringLocator\Search();
|
29 |
|
3 |
namespace StringLocator\REST;
|
4 |
|
5 |
use StringLocator\Base\REST;
|
6 |
+
use StringLocator\String_Locator;
|
7 |
|
8 |
class Search extends REST {
|
9 |
|
25 |
);
|
26 |
}
|
27 |
|
28 |
+
public function permission_callback() {
|
29 |
+
return current_user_can( String_Locator::$search_capability );
|
30 |
+
}
|
31 |
+
|
32 |
public function perform_search( \WP_REST_Request $request ) {
|
33 |
$handler = new \StringLocator\Search();
|
34 |
|
includes/class-string-locator.php
CHANGED
@@ -20,6 +20,20 @@ class String_Locator {
|
|
20 |
*/
|
21 |
public static $default_capability = 'edit_themes';
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
/**
|
24 |
* An array containing all notices to display.
|
25 |
*
|
@@ -368,7 +382,7 @@ class String_Locator {
|
|
368 |
}
|
369 |
|
370 |
$table = sprintf(
|
371 |
-
'<table class="%s" id="string-locator-search-results-table"><thead>%s</thead><tbody>%s</tbody><tfoot>%s</tfoot></table>',
|
372 |
implode( ' ', $table_class ),
|
373 |
$table_columns,
|
374 |
implode( "\n", $table_rows ),
|
20 |
*/
|
21 |
public static $default_capability = 'edit_themes';
|
22 |
|
23 |
+
/**
|
24 |
+
* The capability required to perform searches, but not necessarily edit files.
|
25 |
+
*
|
26 |
+
* We use the `edit_users` capability here, although this is not technically the most ideal,
|
27 |
+
* all other relevant capabilities are disabled in one way or another when certain features
|
28 |
+
* are used to disable things like the plugin or theme editing.
|
29 |
+
*
|
30 |
+
* The use of `edit_users` may also cause other problems, but we do not want to allow any user
|
31 |
+
* access to search the entire filesystem, or database, without some sort of restriction.
|
32 |
+
*
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
public static $search_capability = 'edit_users';
|
36 |
+
|
37 |
/**
|
38 |
* An array containing all notices to display.
|
39 |
*
|
382 |
}
|
383 |
|
384 |
$table = sprintf(
|
385 |
+
'<table class="%s" id="string-locator-search-results-table"><thead>%s</thead><tbody id="string-locator-search-results-tbody">%s</tbody><tfoot>%s</tfoot></table>',
|
386 |
implode( ' ', $table_class ),
|
387 |
$table_columns,
|
388 |
implode( "\n", $table_rows ),
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/plugins/string-locator/
|
|
5 |
Tags: text, search, find, syntax, highlight
|
6 |
Requires at least: 4.9
|
7 |
Tested up to: 6.0
|
8 |
-
Stable tag: 2.6.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -46,6 +46,11 @@ When writing your search string, make sure to wrap your search in forward slashe
|
|
46 |
|
47 |
== Changelog ==
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
= 2.6.0 (2022-07-20) =
|
50 |
* Added database search feature.
|
51 |
* Added tools for quickly replacing data in the search results.
|
5 |
Tags: text, search, find, syntax, highlight
|
6 |
Requires at least: 4.9
|
7 |
Tested up to: 6.0
|
8 |
+
Stable tag: 2.6.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
46 |
|
47 |
== Changelog ==
|
48 |
|
49 |
+
= 2.6.1 (2022-11-02) =
|
50 |
+
* Fixed a bug causing certain setups to be unable to perform searches when editing would also be unavailable.
|
51 |
+
* Fixed a bug causing certain plugins to prevent the search results list from being displayed properly.
|
52 |
+
* Verified compatibility with WordPress 6.1
|
53 |
+
|
54 |
= 2.6.0 (2022-07-20) =
|
55 |
* Added database search feature.
|
56 |
* Added tools for quickly replacing data in the search results.
|
string-locator.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: String Locator
|
4 |
-
* Plugin URI:
|
5 |
* Description: Scan through theme and plugin files looking for text strings
|
6 |
-
* Version: 2.6.
|
7 |
* Author: InstaWP
|
8 |
* Author URI: https://instawp.com/
|
9 |
* Text Domain: string-locator
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: String Locator
|
4 |
+
* Plugin URI: https://wordpress.org/plugins/string-locator/
|
5 |
* Description: Scan through theme and plugin files looking for text strings
|
6 |
+
* Version: 2.6.1
|
7 |
* Author: InstaWP
|
8 |
* Author URI: https://instawp.com/
|
9 |
* Text Domain: string-locator
|
views/editors/default.php
CHANGED
@@ -113,7 +113,7 @@ if ( 'sql' !== $_GET['file-type'] ) {
|
|
113 |
<div id="string-locator-notices">
|
114 |
<div class="row notice notice-error inline below-h2 hide-if-js">
|
115 |
<p>
|
116 |
-
<?php esc_html_e( 'The editor requires
|
117 |
</p>
|
118 |
</div>
|
119 |
|
113 |
<div id="string-locator-notices">
|
114 |
<div class="row notice notice-error inline below-h2 hide-if-js">
|
115 |
<p>
|
116 |
+
<?php esc_html_e( 'The editor requires JavaScript to be enabled before it can be used.', 'string-locator' ); ?>
|
117 |
</p>
|
118 |
</div>
|
119 |
|
views/search.php
CHANGED
@@ -40,7 +40,7 @@ if ( isset( $_GET['restore'] ) ) {
|
|
40 |
|
41 |
<?php do_action( 'string_locator_view_search_pre_form' ); ?>
|
42 |
|
43 |
-
<?php if ( ! current_user_can(
|
44 |
<div class="notice notice-warning inline">
|
45 |
<p>
|
46 |
<strong>
|
@@ -50,6 +50,26 @@ if ( isset( $_GET['restore'] ) ) {
|
|
50 |
<p>
|
51 |
<?php esc_html_e( 'Because this site is configured to not allow direct file editing, the String Locator plugin has limited functionality and may noy allow you to directly edit files with your string in them.', 'string-locator' ); ?>
|
52 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
</div>
|
54 |
<?php endif; ?>
|
55 |
|
40 |
|
41 |
<?php do_action( 'string_locator_view_search_pre_form' ); ?>
|
42 |
|
43 |
+
<?php if ( ! current_user_can( String_Locator::$default_capability ) ) : ?>
|
44 |
<div class="notice notice-warning inline">
|
45 |
<p>
|
46 |
<strong>
|
50 |
<p>
|
51 |
<?php esc_html_e( 'Because this site is configured to not allow direct file editing, the String Locator plugin has limited functionality and may noy allow you to directly edit files with your string in them.', 'string-locator' ); ?>
|
52 |
</p>
|
53 |
+
<p>
|
54 |
+
<?php esc_html_e( sprintf( 'To edit files, you need to have the `%s` capability.', String_Locator::$default_capability ), 'string-locator' ); ?>
|
55 |
+
</p>
|
56 |
+
</div>
|
57 |
+
<?php endif; ?>
|
58 |
+
|
59 |
+
<?php if ( ! current_user_can( String_Locator::$search_capability ) ) : ?>
|
60 |
+
<div class="notice notice-warning inline">
|
61 |
+
<p>
|
62 |
+
<strong>
|
63 |
+
<?php esc_html_e( 'String Locator is restricted.', 'string-locator' ); ?>
|
64 |
+
</strong>
|
65 |
+
</p>
|
66 |
+
<p>
|
67 |
+
<?php esc_html_e( 'Your user does not have the needed capabilities to edit, or search through files on this site.', 'string-locator' ); ?>
|
68 |
+
</p>
|
69 |
+
|
70 |
+
<p>
|
71 |
+
<?php esc_html_e( sprintf( 'To use the search feature, you need to have the `%s` capability.', String_Locator::$search_capability ), 'string-locator' ); ?>
|
72 |
+
</p>
|
73 |
</div>
|
74 |
<?php endif; ?>
|
75 |
|