Plugin Directory

Changeset 1661644


Ignore:
Timestamp:
05/21/2017 12:10:27 PM (9 years ago)
Author:
freelancephp
Message:

version 2.1.2

Location:
wp-external-links/trunk
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • wp-external-links/trunk/includes/admin/class-wpel-network-page.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/includes/admin/class-wpel-settings-page.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/includes/admin/network-fields/class-wpel-network-admin-fields.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    1111 * @license  Dual licensed under the MIT and GPLv2+ licenses
    1212 */
    13 final class WPEL_Network_Admin_Fields extends FWP_Settings_Section_Fields_1x0x0
     13final class WPEL_Network_Admin_Fields extends FWP_Settings_Section_Base_1x0x0
    1414{
    1515
  • wp-external-links/trunk/includes/admin/network-fields/class-wpel-network-fields.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    1111 * @license  Dual licensed under the MIT and GPLv2+ licenses
    1212 */
    13 final class WPEL_Network_Fields extends FWP_Settings_Section_Fields_1x0x0
     13final class WPEL_Network_Fields extends FWP_Settings_Section_Base_1x0x0
    1414{
    1515
  • wp-external-links/trunk/includes/admin/settings-fields/class-wpel-admin-fields.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    1111 * @license  Dual licensed under the MIT and GPLv2+ licenses
    1212 */
    13 final class WPEL_Admin_Fields extends FWP_Settings_Section_Fields_1x0x0
     13final class WPEL_Admin_Fields extends FWP_Settings_Section_Base_1x0x0
    1414{
    1515
  • wp-external-links/trunk/includes/admin/settings-fields/class-wpel-exceptions-fields.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    1111 * @license  Dual licensed under the MIT and GPLv2+ licenses
    1212 */
    13 final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
     13final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Base_1x0x0
    1414{
    1515
     
    117117        $this->get_html_fields()->check_with_label(
    118118            $args[ 'key' ]
    119             , __( 'Threat all links to the site\'s domain and subdomains as internal links', 'wp-external-links' )
     119            , __( 'Treat all links to the site\'s domain and subdomains as internal links', 'wp-external-links' )
    120120            , '1'
    121121            , ''
  • wp-external-links/trunk/includes/admin/settings-fields/class-wpel-excluded-link-fields.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/includes/admin/settings-fields/class-wpel-external-link-fields.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/includes/admin/settings-fields/class-wpel-internal-link-fields.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/includes/admin/settings-fields/class-wpel-link-fields-base.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    1111 * @license  Dual licensed under the MIT and GPLv2+ licenses
    1212 */
    13 abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
     13abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Base_1x0x0
    1414{
    1515
     
    116116                '_self'     => __( 'in the same window, tab or frame', 'wp-external-links' ),
    117117                '_blank'    => __( 'each in a separate new window or tab', 'wp-external-links' ),
    118                 '_new'      => __( 'all in the same new window or tab', 'wp-external-links' ),
    119                 '_top'      => __( 'in the topmost frame', 'wp-external-links' ),
     118                '_new'      => __( 'all in the same new window or tab (NOT recommended)', 'wp-external-links' ),
     119                '_top'      => __( 'in the topmost frame (NOT recommended)', 'wp-external-links' ),
    120120            )
    121121        );
  • wp-external-links/trunk/includes/class-wpel-front-ignore.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/includes/class-wpel-front.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    2727        $this->settings_page = $settings_page;
    2828
     29        // load front ignore
     30        WPEL_Front_Ignore::create( $settings_page );
     31
     32        // load template tags
     33        WPEL_Template_Tags::create( $this );
     34
    2935        // apply page sections
    3036        if ( $this->opt( 'apply_all' ) ) {
     37            // create final_output filterhook
     38            FWP_Final_Output_1x0x0::create();
     39
    3140            add_action( 'final_output', $this->get_callback( 'scan' ), 10000000000 );
    3241        } else {
     
    4251
    4352            if ( $this->opt( 'apply_widgets' ) ) {
     53                // create widget_output filterhook
     54                FWP_Widget_Output_1x0x0::create();
     55
    4456                array_push( $filter_hooks, 'widget_output' );
    4557            }
     
    4961            }
    5062        }
     63    }
     64
     65    /**
     66     * Turn off output buffer for REST API calls
     67     * @param type $wp_rest_server
     68     */
     69    protected function action_rest_api_init()
     70    {
     71        ob_end_clean();
    5172    }
    5273
     
    381402
    382403        // is internal
    383         if ( false !== strpos( $url, home_url() ) ) {
     404        if ( false !== strpos( $url, home_url( '' ) )
     405                || false !== strpos( $url, home_url( '', 'https' ) ) ) {
    384406            return true;
    385407        }
  • wp-external-links/trunk/includes/class-wpel-link.php

    r1435123 r1661644  
    88 * @package  WPEL
    99 * @category WordPress Plugin
    10  * @version  2.1.1
     10 * @version  2.1.2
    1111 * @author   Victor Villaverde Laan
    1212 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/includes/class-wpel-plugin.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    1111 * @license  Dual licensed under the MIT and GPLv2+ licenses
    1212 */
    13 final class WPEL_Plugin extends WPRun_Base_1x0x0
     13final class WPEL_Plugin extends FWP_Plugin_Base_1x0x0
    1414{
    15 
    16     /**
    17      * @var string
    18      */
    19     private static $plugin_file = null;
    20 
    21     /**
    22      * @var string
    23      */
    24     private static $plugin_dir = null;
    2515
    2616    /**
     
    3121    protected function init( $plugin_file, $plugin_dir )
    3222    {
    33         self::$plugin_file = $plugin_file;
    34         self::$plugin_dir = untrailingslashit( $plugin_dir );
     23        parent::init( $plugin_file, $plugin_dir );
    3524
    36         WPEL_Register_Hooks::create();
     25        $this->create_components();
     26    }
     27
     28    /**
     29     * Create components
     30     */
     31    protected function create_components()
     32    {
    3733        WPEL_Register_Scripts::create();
    3834
     
    5450        // front site
    5551        if ( ! is_admin() ) {
    56             // filter hooks
    57             FWP_Final_Output_1x0x0::create();
    58             FWP_Widget_Output_1x0x0::create();
    59 
    60             // front site
    6152            WPEL_Front::create( $settings_page );
    62             WPEL_Front_Ignore::create( $settings_page );
    63 
    64             WPEL_Template_Tags::create();
    6553        }
    6654
     
    6957    }
    7058
    71     /**
    72      * Action for "plugins_loaded"
    73      */
    74     protected function action_plugins_loaded()
    75     {
    76         load_plugin_textdomain( 'wp-external-links', false, WPEL_Plugin::get_plugin_dir( '/languages' )  );
    77     }
    78 
    79     /**
    80      * @return string
    81      */
    82     public static function get_plugin_file()
    83     {
    84         return self::$plugin_file;
    85     }
    86 
    87     /**
    88      * @param string $path Optional
    89      * @return string
    90      */
    91     public static function get_plugin_dir( $path = '' )
    92     {
    93         return self::$plugin_dir . $path;
    94     }
    95 
    9659}
    9760
  • wp-external-links/trunk/includes/class-wpel-register-scripts.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/includes/class-wpel-template-tags.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    1111 * @license  Dual licensed under the MIT and GPLv2+ licenses
    1212 */
    13 final class WPEL_Template_Tags extends WPRun_Base_1x0x0
     13final class WPEL_Template_Tags extends FWP_Template_Tag_Base_1x0x0
    1414{
    1515
    1616    /**
    17      * Create template tag(s)
     17     * @var WPEL_Front
    1818     */
    19     protected function init()
     19    private $front = null;
     20
     21    /**
     22     * Initialize
     23     * @param WPEL_Front $front
     24     */
     25    protected function init( WPEL_Front $front )
    2026    {
    21         $this->create_templatetag();
     27        $this->front = $front;
    2228    }
    2329
    2430    /**
    25      * Create template tag
    26      * @return void
     31     * Template tag funtion
     32     * @param string $content
     33     * @return string
    2734     */
    28     protected function create_templatetag()
     35    public function wpel_filter( $content )
    2936    {
    30         if ( function_exists( 'wpel_filter' ) ) {
    31             return;
    32         }
    33 
    34         /**
    35          * Template tag to apply plugin settings on given content
    36          * @return string
    37          */
    38         function wpel_filter( $content ) {
    39             // hidden dependency to WPEL_Front::scan()
    40             return WPEL_Front::get_instance()->scan( $content );
    41         }
     37        return $this->front->scan( $content );
    4238    }
    4339
  • wp-external-links/trunk/includes/class-wpel-update.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/libs/fwp/class-fwp-debug.php

    r1430239 r1661644  
    7575    /**
    7676     * Log all hooks being applied
    77      * @global type $merged_filters
     77     * @global array $wp_filter
    7878     */
    7979    protected function log_hooks()
    8080    {
    81         global $merged_filters;
     81        global $wp_filter;
    8282
    83         self::log( $merged_filters, 'WP Hooks' );
     83        $hooks = array_keys( $wp_filter );
     84        self::log( $hooks, 'WP Hooks' );
    8485    }
    8586
    8687    /**
    87      * 
     88     *
    8889     */
    8990    public static function start_benchmark( $label = 'benchmark' )
     
    9394
    9495    /**
    95      * 
     96     *
    9697     */
    9798    public static function end_benchmark( $label = 'benchmark' )
  • wp-external-links/trunk/libs/wprun/class-wprun-autoloader.php

    r1430239 r1661644  
    4646    final public function add_path( $path, $include_subfolders = false )
    4747    {
    48         if ( in_array( $path, $this->paths ) ) {
     48        $absolute_path = self::get_absolute_path( $path );
     49
     50        if ( ! is_dir( $absolute_path ) ) {
    4951            return;
    5052        }
    5153
    52         $this->paths[] = $path;
     54        if ( in_array( $absolute_path, $this->paths ) ) {
     55            return;
     56        }
     57
     58        $this->paths[] = $absolute_path;
    5359
    5460        // include subfolders
    5561        if ( true === $include_subfolders ) {
    56             $entries = scandir( $path );
     62            $entries = scandir( $absolute_path );
    5763
    5864            foreach ( $entries as $entry ) {
     
    6167                }
    6268
    63                 $item = $path . DIRECTORY_SEPARATOR . $entry;
     69                $item = $absolute_path . DIRECTORY_SEPARATOR . $entry;
    6470
    65                 if ( is_dir( $item ) ) {
    66                     $this->add_path( $item, true );
     71                if ( ! is_dir( $item ) ) {
     72                    continue;
    6773                }
     74
     75                $this->add_path( $item, true );
    6876            }
    6977        }
    70      }
     78    }
    7179
    7280    /**
     
    9098
    9199        $file_name = '';
    92         $file_name .= $this->settings['file_name_prefix'];
    93         $file_name .= str_replace( '_', $this->settings['replace_dashes_with'], $pure_class_name );
     100        $file_name .= $this->settings[ 'file_name_prefix' ];
     101        $file_name .= str_replace( '_', $this->settings[ 'replace_dashes_with' ], $pure_class_name );
    94102        $file_name .= '.php';
    95103
     
    111119    }
    112120
     121    /**
     122     * Convert to clean absolute path
     123     * @param string $path
     124     * @return string
     125     */
     126    final static protected function get_absolute_path( $path )
     127    {
     128        // convert to OS directory separator
     129        $clean_path = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path );
     130
     131        $parts = array_filter( explode( DIRECTORY_SEPARATOR, $clean_path ), 'strlen' );
     132
     133        $absolutes = array();
     134
     135        foreach ( $parts as $part ) {
     136            if ( '.' === $part ) {
     137                continue;
     138            }
     139
     140            if ( '..' === $part ) {
     141                array_pop( $absolutes );
     142            } else {
     143                $absolutes[] = $part;
     144            }
     145        }
     146
     147        $absolute_path = implode( DIRECTORY_SEPARATOR, $absolutes );
     148
     149        // check if given path started with directory separator
     150        if ( DIRECTORY_SEPARATOR === $clean_path[ 0 ] ) {
     151            $absolute_path = DIRECTORY_SEPARATOR . $absolute_path;
     152        }
     153
     154        return $absolute_path;
     155    }
     156
    113157}
    114158
  • wp-external-links/trunk/libs/wprun/class-wprun-base.php

    r1435123 r1661644  
    33 * Class WPRun_Base_1x0x0
    44 *
    5  * Base class for concrete subclasses
    6  * All subclasses are singletons and can be instantiated with
    7  * the static "create()" factory method.
     5 * Base abstract class can be extended for easy WP Plugin and Theme development.
     6 * All subclasses are singletons and can be instantiated with the static
     7 * "create()" factory method.
    88 *
    99 * @package  WPRun
     
    2222    /**
    2323     * Page hook
    24      * If page hook isset, will only apply hook methods when page hook is the current screen id
     24     * Page hook can be set by subclasses, in that case filter and action methods
     25     * will only be set if page hook is the current screen id
    2526     * @var string
    2627     */
     
    4445
    4546    /**
    46      * @var array
    47      */
    48     protected $default_settings = array();
    49 
    50     /**
    51      * @var array
    52      */
    53     private $settings = array();
    54 
    55     /**
    56      * Only for internal use
     47     * Only for internal use (to recognize a callback call)
    5748     * @var string
    5849     */
     
    10697        $this->arguments = $arguments;
    10798
    108         if ( true === $this->autoset_hook_methods ) {
    109             $this->set_hook_methods();
    110         }
    111 
    11299        // call init method
    113100        $method_name = 'init';
     
    122109            }
    123110        }
     111
     112        // automatically set methods as callback for WP hooks
     113        if ( true === $this->autoset_hook_methods ) {
     114            $this->set_hook_methods();
     115        }
    124116    }
    125117
    126118    /**
    127119     * @return WPRun_Base_1x0x0
     120     * @triggers E_USER_NOTICE Instance not yet created
    128121     */
    129122    final public static function get_instance()
    130123    {
    131124        $class_name = get_called_class();
     125
     126        if ( ! isset( self::$instances[ $class_name ] ) ) {
     127            trigger_error( 'Instance of "'. $class_name .'" was not created.' );
     128        }
     129
    132130        return self::$instances[ $class_name ];
    133     }
    134 
    135     /**
    136      * @param string $key
    137      * @return mixed
    138      */
    139     final public function get_setting( $key )
    140     {
    141         return $this->settings[ $key ];
    142     }
    143 
    144     /**
    145      * @param array $settings
    146      */
    147     final protected function set_settings( array $settings )
    148     {
    149         if ( empty( $this->settings ) ) {
    150             $this->settings = wp_parse_args( $settings, $this->default_settings );
    151         } else {
    152             $this->settings = wp_parse_args( $settings, $this->settings );
    153         }
    154131    }
    155132
     
    199176
    200177        // output template
    201         $this->show_template( $template_file_path, $vars );
     178        self::show_template( $template_file_path, $vars );
    202179
    203180        // get the view content
     
    295272            $action_name = self::fetch_name_containing_prefix( $this->action_prefix, $method_name );
    296273            if ( null !== $action_name ) {
    297                 self::add_to_hook( $this, 'action', $action_name, $method_name );
     274                $this->add_to_hook( 'action', $action_name, $method_name );
    298275                continue;
    299276            }
     
    301278            $filter_name = self::fetch_name_containing_prefix( $this->filter_prefix, $method_name );
    302279            if ( null !== $filter_name ) {
    303                 self::add_to_hook( $this, 'filter', $filter_name, $method_name );
     280                $this->add_to_hook( 'filter', $filter_name, $method_name );
    304281                continue;
    305282            }
     
    308285
    309286    /**
    310      * Must be public but for internal use only
    311      * to support PHP 5.3 which doesn't recognize being used within class scope
    312      * @param string $method_name
    313      * @return array
    314      */
    315     final public function _get_callback( $method_name )
    316     {
    317         return $this->get_callback( $method_name );
    318     }
    319 
    320     /**
    321      * Must be public but for internal use only
    322      * to support PHP 5.3 which doesn't recognize being used within class scope
    323      * @return string
    324      */
    325     final public function _get_page_hook()
    326     {
    327         return $this->page_hook;
    328     }
    329 
    330     /**
    331      * @param WPRun_Base_1x0x0 $self
    332287     * @param string $hook_type "action" or "filter"
    333288     * @param string $hook_name
     
    335290     * @triggers E_USER_NOTICE
    336291     */
    337     private static function add_to_hook( $self, $hook_type, $hook_name, $method_name )
     292    private function add_to_hook( $hook_type, $hook_name, $method_name )
    338293    {
    339294        // fetch priority outof method name
     
    353308        $accepted_args = $method_reflection->getNumberOfParameters();
    354309
    355         // check if actions and filters are applied for page hook
    356         $callback = function () use ( $self, $method_name ) {
    357             if ( function_exists( 'get_current_screen' ) && null !== $self->_get_page_hook() ) {
    358                 if ( is_network_admin() ) {
    359                     $page_hook = $self->_get_page_hook() .'-network';
    360                 } else {
    361                     $page_hook = $self->_get_page_hook();
    362                 }
    363 
    364                 if ( get_current_screen()->id !== $page_hook ) {
    365                     return;
    366                 }
    367             }
    368 
    369             return call_user_func_array( $self->_get_callback( $method_name ), func_get_args() );
     310        // set internal wp hook action or filter callback
     311        $method_callback = $this->get_callback( $method_name );
     312        $check_call_hook = $this->get_callback( 'check_call_hook' );
     313
     314        $callback = function () use ( $method_callback, $check_call_hook ) {
     315            $call_hook = call_user_func( $check_call_hook );
     316           
     317            if ( false === $call_hook ) {
     318                return;
     319            }
     320
     321            return call_user_func_array( $method_callback, func_get_args() );
    370322        };
    371323
     
    380332
    381333    /**
     334     * Check if an action or filter hook should be called (correct page hook)
     335     * @return boolean
     336     */
     337    final protected function check_call_hook()
     338    {
     339        if ( null === $this->page_hook ) {
     340            return true;
     341        }
     342
     343        if ( is_network_admin() ) {
     344            $page_hook = $this->page_hook .'-network';
     345        } else {
     346            $page_hook = $this->page_hook;
     347        }
     348
     349        if ( get_current_screen()->id === $page_hook ) {
     350            return true;
     351        }
     352
     353        return false;
     354    }
     355
     356    /**
    382357     * @param string $prefix
    383358     * @param string $name
  • wp-external-links/trunk/public/css/wpel-admin.css

    r1433846 r1661644  
    1212    content: '\00a0';
    1313}
     14
    1415.wpel-hidden {
    1516    display: none;
    1617}
     18
     19/**
     20 * Menu Icon
     21 */
    1722
    1823a.toplevel_page_wpel-settings-page .wp-menu-image:before {
     
    2530    content:  '\f14c';
    2631}
     32
     33/**
     34 * Tabs
     35 */
    2736
    2837.wpel-settings-page .nav-tab i,
     
    6978   font-style: italic;
    7079}
     80
    7181
    7282/**
  • wp-external-links/trunk/public/js/wpel-admin.js

    r1433846 r1661644  
    66jQuery(function ($) {
    77    'use strict';
     8   
     9    // add custom jQuery show/hide function
     10    $.extend($.fn, {
     11        wpelShow: function () {
     12            var self = this;
     13            this.stop({ clearQueue: true, jumpToEnd: true });
     14            this.fadeIn({ duration: 500, queue: false, complete: function () {
     15                self.removeClass('wpel-hidden');
     16            }});
     17        },
     18        wpelHide: function () {
     19            var self = this;
     20            this.stop({ clearQueue: true, jumpToEnd: true });
     21            this.fadeOut({ duration: 500, queue: false, complete: function () {
     22                self.addClass('wpel-hidden');
     23            }});
     24        }
     25    });
    826
    927    var $wrapper = $('.wpel-settings-page');
     
    1331     */
    1432    $wrapper.on('change', '.js-wpel-apply input', function () {
    15         var apply_all = $(this).is(':checked');
     33        var applyAll = $(this).is(':checked');
    1634        var $items = $wrapper.find('.js-wpel-apply-child');
    1735
    18         if (apply_all) {
    19             $items.hide();
     36        if (applyAll) {
     37            $items.wpelHide();
    2038        } else {
    21             $items.show();
     39            $items.wpelShow();
    2240        }
    2341    });
    2442
    2543    // trigger immediatly
    26     $wrapper.find('.js-wpel-apply input').change();
    27 
     44    $wrapper.find('.js-wpel-apply input[type="checkbox"]').change();
    2845
    2946    /**
     
    3855
    3956        if (iconType === 'image') {
    40             $itemsDepend.show();
    41             $itemsChild.filter('.js-icon-type-image').show();
     57            $itemsDepend.wpelShow();
     58            $itemsChild.filter('.js-icon-type-image').wpelShow();
    4259        } else if (iconType === 'dashicon') {
    43             $itemsDepend.show();
    44             $itemsChild.filter('.js-icon-type-dashicon').show();
     60            $itemsDepend.wpelShow();
     61            $itemsChild.filter('.js-icon-type-dashicon').wpelShow();
    4562        } else if (iconType === 'fontawesome') {
    46             $itemsDepend.show();
    47             $itemsChild.filter('.js-icon-type-fontawesome').show();
     63            $itemsDepend.wpelShow();
     64            $itemsChild.filter('.js-icon-type-fontawesome').wpelShow();
    4865        } else {
    49             $itemsDepend.hide();
     66            $itemsDepend.wpelHide();
    5067        }
    5168    });
    5269
    53     $wrapper.on('change', '.js-apply-settings input', function () {
     70    $wrapper.on('change', '.js-apply-settings input[type="checkbox"]', function () {
    5471        var $items = $wrapper.find('.form-table tr').not('.js-apply-settings');
    5572
    5673        if ($(this).prop('checked')) {
    57             $items.show();
     74            $items.wpelShow();
    5875            $wrapper.find('.js-icon-type select').change();
    5976        } else {
    60             $items.hide();
     77            $items.wpelHide();
    6178        }
    6279    });
    6380
    6481    // trigger immediatly
    65     $wrapper.find('.js-apply-settings input').change();
     82    $wrapper.find('.js-apply-settings input[type="checkbox"]').change();
    6683
    6784
    6885    /**
    6986     * Support
     87     * Copy to clipboard
    7088     */
    7189    $wrapper.on('click', '.js-wpel-copy', function (e) {
     
    103121    });
    104122
    105 
     123    // show current tab
     124    $wrapper.find('form').wpelShow();
     125    // for network pages
     126    $('.wpel-network-page').find('form').wpelShow();
     127   
    106128});
  • wp-external-links/trunk/readme.txt

    r1618209 r1661644  
    33Tags: links, new window, new tab, external links, nofollow, follow, seo, noopener, noreferrer, internal links, link icon, link target, _blank, wpmu
    44Requires at least: 4.2.0
    5 Tested up to: 4.7.3
    6 Stable tag: 2.1.1
     5Tested up to: 4.7.5
     6Stable tag: 2.1.2
    77
    88Open external links in a new tab / window, add "nofollow", "noopener" and font icons, SEO and more. Also for internal links.
     
    155155});`
    156156
     157= How to open f.e. PDF files in a new window? =
     158
     159Use some JavaScript code for opening PDF files in a new window:
     160
     161`jQuery(function ($) {
     162    $('a[href$=".pdf"]').prop('target', '_blank');
     163});`
     164
     165= How to set another icon for secure sites (using https)? =
     166
     167Use some CSS style to change the icon for secure sites using https:
     168
     169`a[href^="https"] .wpel-icon:before {
     170  content: "\f023" !important;
     171}`
     172
     173The code `\f023` refers to a dashicon or font awesome icon.
     174
    157175= I am a plugin developer and my plugin conflicts with WPEL. How can I solve the problem? =
    158176
     
    239257
    240258== Changelog ==
     259
     260= 2.1.2 =
     261 * Fixed bug checking internal links with https
     262 * Fixed bug with REST API
     263 * Fixed conflict Widget CSS Classes plugin (partially fixed)
    241264
    242265= 2.1.1 =
  • wp-external-links/trunk/templates/network-page/help-tabs/under-construction.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/network-page/main.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/network-page/tab-contents/network-admin-settings.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/network-page/tab-contents/network-settings.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/partials/nav-tabs.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/partials/tab-contents/fields-default.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/partials/tab-contents/support.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/requirements-notice.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/settings-page/help-tabs/data-attributes.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/settings-page/help-tabs/under-construction.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/settings-page/main.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
     
    3131    ?>
    3232
    33     <form method="post" action="options.php">
     33    <form method="post" action="options.php" class="wpel-hidden">
    3434        <?php
    3535            $content_tab_template = __DIR__ .'/tab-contents/'. $vars[ 'current_tab' ] .'.php';
  • wp-external-links/trunk/templates/settings-page/tab-contents/admin.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/settings-page/tab-contents/exceptions.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/settings-page/tab-contents/excluded-links.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/settings-page/tab-contents/external-links.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/templates/settings-page/tab-contents/internal-links.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     http://www.finewebdev.com
  • wp-external-links/trunk/wp-external-links.php

    r1435123 r1661644  
    55 * @package  WPEL
    66 * @category WordPress Plugin
    7  * @version  2.1.1
     7 * @version  2.1.2
    88 * @author   Victor Villaverde Laan
    99 * @link     https://wordpress.org/plugins/wp-external-links/
     
    1313 * @wordpress-plugin
    1414 * Plugin Name:    WP External Links
    15  * Version:        2.1.1
     15 * Version:        2.1.2
    1616 * Plugin URI:     https://wordpress.org/plugins/wp-external-links/
    1717 * Description:    Open external links in a new tab or window, adding "nofollow" and "noopener", set font icon, SEO friendly options and more.
     
    2323 */
    2424if ( ! function_exists( 'wpel_init' ) ):
     25
    2526    function wpel_init()
    2627    {
     
    3031        }
    3132
     33        $plugin_file = defined( 'TEST_WPEL_PLUGIN_FILE' ) ? TEST_WPEL_PLUGIN_FILE : __FILE__;
     34        $plugin_dir = dirname( __FILE__ );
     35
    3236        // check requirements
    3337        $wp_version = get_bloginfo( 'version' );
    3438        $php_version = phpversion();
    3539
    36         if ( version_compare( $wp_version, '3.6', '<' ) || version_compare( $php_version, '5.3', '<' ) ) {
     40        if ( version_compare( $wp_version, '4.2', '<' ) || version_compare( $php_version, '5.3', '<' ) ) {
    3741            if ( ! function_exists( 'wpel_requirements_notice' ) ) {
    3842                function wpel_requirements_notice()
    3943                {
    40                     // php 5.2 doesn't yet support __DIR__
    4144                    include dirname( __FILE__ ) .'/templates/requirements-notice.php';
    4245                }
     
    5154         * Autoloader
    5255         */
    53         require_once __DIR__ . '/libs/wprun/class-wprun-autoloader.php';
     56        if ( ! class_exists( 'WPRun_Autoloader_1x0x0' ) ) {
     57            require_once $plugin_dir . '/libs/wprun/class-wprun-autoloader.php';
     58        }
    5459
    5560        $autoloader = new WPRun_Autoloader_1x0x0();
    56         $autoloader->add_path( __DIR__ . '/libs/', true );
    57         $autoloader->add_path( __DIR__ . '/includes/', true );
     61        $autoloader->add_path( $plugin_dir . '/libs/', true );
     62        $autoloader->add_path( $plugin_dir . '/includes/', true );
    5863
    5964        /**
     
    6772
    6873        /**
     74         * Register Hooks
     75         */
     76        global $wpdb;
     77        WPEL_Activation::create( $plugin_file, $wpdb );
     78        WPEL_Uninstall::create( $plugin_file, $wpdb );
     79
     80        /**
    6981         * Set plugin vars
    7082         */
    71         WPEL_Plugin::create(
    72             defined( 'TEST_WPEL_PLUGIN_FILE' ) ? TEST_WPEL_PLUGIN_FILE : __FILE__
    73             , __DIR__
    74         );
     83        WPEL_Plugin::create( $plugin_file, $plugin_dir );
     84
    7585    }
    7686
    7787    wpel_init();
     88
    7889endif;
    7990
Note: See TracChangeset for help on using the changeset viewer.