Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/wp-content/plugins/widget-context/widget-context.php b/wp-content/plugins/widget-context/widget-context.php
- index 477574a..dd88576 100755
- --- a/wp-content/plugins/widget-context/widget-context.php
- +++ b/wp-content/plugins/widget-context/widget-context.php
- @@ -415,15 +415,47 @@ class widget_context {
- function context_check_url( $check, $settings ) {
- + global $wp;
- + $current_path = trim( $wp->request );
- +
- $settings = wp_parse_args(
- $settings,
- array(
- - 'urls' => null
- + 'urls' => null,
- )
- );
- $urls = trim( $settings['urls'] );
- + /**
- + * Targeted URLs, including URLs negated with "!".
- + */
- + $urls_all = explode( "\n", $urls );
- +
- + /**
- + * Holds urls negated with not (!).
- + */
- + $urls_excluded = array();
- +
- + /**
- + * Remove leading "!"" before adding to excluded URL list.
- + */
- + $charmask = " \t\n\r\0\x0B!";
- + foreach ( $urls_all as $url ) {
- + if ( 0 === strpos( $url, '!' ) ) {
- + $urls_excluded[] = trim( $url, $charmask );
- + }
- + }
- +
- + /**
- + * Deny widget if current path matches an excluded URL.
- + */
- + foreach ( $urls_excluded as $not_url ) {
- + if ( $current_path === $not_url ) {
- + return $check;
- + }
- + }
- +
- if ( empty( $urls ) )
- return $check;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement