Skip to content

Commit

Permalink
Add ctl_allow filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagg-design committed Jul 22, 2023
1 parent 1dfcd5c commit b3931d3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
28 changes: 28 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,33 @@ function my_ctl_pre_sanitize_filename( $result, $filename ) {
add_filter( 'ctl_pre_sanitize_filename', 10, 2 );
`

= How can I allow the plugin to work on the frontend? =

Add similar code to your theme's `functions.php` file:

`
/**
* Filter status allowed Cyr To Lat plugin to work.
*
* @param bool $allowed
*
* @return bool
*/
function my_ctl_allow( bool $allowed ): bool {
$uri = isset( $_SERVER['REQUEST_URI'] ) ?
sanitize_url( wp_unslash( $_SERVER['REQUEST_URI'] ) ) :
'';

if ( 0 === strpos( $uri, '/divi-comments' ) ) {
return true;
}

return $allowed;
}

add_filter( 'ctl_allow', 'my_ctl_allow' );
`

= How can I limit post types for background conversion? =

Add similar code to your theme's `functions.php` file:
Expand Down Expand Up @@ -199,6 +226,7 @@ Yes you can!
* Tested with WordPress 6.3.
* Tested with WooCommerce 7.9.
* Added System Info tab.
* Added filter 'ctl_allow'
* Fixed console error when saving table data.

= 5.5.3 (15.07.2023) =
Expand Down
7 changes: 4 additions & 3 deletions src/php/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ class Request {
* @return bool
*/
public function is_allowed(): bool {
return (
$allowed =
! $this->is_frontend() ||
( $this->is_frontend() && $this->is_post() ) ||
$this->is_cli()
);
$this->is_cli();

return (bool) apply_filters( 'ctl_allow', $allowed );
}

/**
Expand Down

0 comments on commit b3931d3

Please sign in to comment.