Plugin Directory

Changeset 1117983


Ignore:
Timestamp:
03/22/2015 11:59:10 AM (11 years ago)
Author:
twapaw
Message:

Version 3.0.0

Location:
opes-favicon
Files:
39 added
20 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • opes-favicon/trunk/inc/admin/admin.class.php

    r1065076 r1117983  
    11<?php
    22
    3 class Class_Admin {
    4 
    5     private $params = array();
     3class _OFAV_noeg__Admin {
    64
    75    private function __construct( $params ) {
    8         global $added_PHP_Admin_Files;
     6        //global _OFAV_noeg__Conf::$added_PHP_Admin_Files;
    97
    10         if ( is_array( $added_PHP_Admin_Files ) ) {
    11             foreach ( $added_PHP_Admin_Files as $filePath ) {
     8        if ( is_array( _OFAV_noeg__Conf::$added_PHP_Admin_Files ) ) {
     9            foreach ( _OFAV_noeg__Conf::$added_PHP_Admin_Files as $filePath ) {
    1210                include_once( $filePath );
    1311            }
    1412        }
    15        
    16         $directory = new RecursiveDirectoryIterator( _THIS_PLUGIN__ADMIN_DIR_ . 'controller/' );
     13
     14        $PHP_ToLoad = scandir( __OFAV_noeg__THIS_PLUGIN__ADMIN_DIR_ . 'controller/' );
     15        $PHP_ToLoad = preg_grep( '/-ToLoad\.php$/i' , $PHP_ToLoad );
     16        sort ( $PHP_ToLoad , SORT_STRING );
     17
     18        foreach ( $PHP_ToLoad as $key => $fileName ) {
     19            include( __OFAV_noeg__THIS_PLUGIN__ADMIN_DIR_ . 'controller/' . $fileName );
     20        }
     21/*     
     22        $directory = new RecursiveDirectoryIterator( __OFAV_noeg__THIS_PLUGIN__ADMIN_DIR_ . 'controller/' );
    1723        $recIterator = new RecursiveIteratorIterator($directory);
    18         $regex = new RegexIterator($recIterator, '/\.php$/i');
     24        $regex = new RegexIterator( $recIterator, '/-ToLoad\.php$/i' );
     25
    1926        foreach($regex as $item) {
    2027            include $item->getPathname();
    2128        }
    22 
     29*/
    2330        add_action( 'admin_enqueue_scripts', array( $this , 'addAddedScriptsAndStyles' ) );
    2431    }
    2532
    2633    public static function init( $params ) {
    27         return new Class_Admin( $params );
     34        return new _OFAV_noeg__Admin( $params );
    2835    }
    2936
    30     private function setParam( $name , $value ) {
    31         if ( is_string( $name ) ) {
    32             $this->params[ $name ] = $value;
    33         }
    34     }
     37    public function addAddedScriptsAndStyles( $hook ) {
     38        //global _OFAV_noeg__Conf::$added_SCRIPT_Admin_Files , _OFAV_noeg__Conf::$added_STYLE_Admin_Files;
    3539
    36     private function unsetParam( $name , $value ) {
    37         if ( is_string( $name ) ) {
    38             unset( $this->params[ $name ] );
    39         }
    40     }
    41 
    42     public function addAddedScriptsAndStyles() {
    43         global $added_SCRIPT_Admin_Files , $added_STYLE_Admin_Files;
    44 
    45         if ( is_array( $added_SCRIPT_Admin_Files ) ) {
    46             foreach ( $added_SCRIPT_Admin_Files as $script ) {
    47                 Class_Main::addScript( $script );
     40        if ( is_array( _OFAV_noeg__Conf::$added_SCRIPT_Admin_Files ) ) {
     41            foreach ( _OFAV_noeg__Conf::$added_SCRIPT_Admin_Files as $script ) {
     42                if ( isset( $script[ 'hook_deps' ] ) ) {
     43                    if ( is_string( $script[ 'hook_deps' ] ) ) {
     44                        if ( strpos( $hook , trim( $script[ 'hook_deps' ] ) ) ) {
     45                            _OFAV_noeg__Main::addScript( $script );
     46                        }
     47                    } else if ( is_array( $script[ 'hook_deps' ] ) ) {
     48                        foreach ( $script[ 'hook_deps' ] as $value ) {
     49                            if ( strpos( $hook , trim( $value ) ) !== false ) {
     50                                _OFAV_noeg__Main::addScript( $script );
     51                                break;
     52                            }
     53                        }
     54                    }
     55                } else {
     56                    print_r( _OFAV_noeg__Main::addScript( $script ) );
     57                }
    4858            }
    4959        };
    5060
    51         if ( is_array( $added_STYLE_Admin_Files ) ) {
    52             foreach ( $added_STYLE_Admin_Files as $style ) {
    53                 Class_Main::addStyle( $style );
     61        if ( is_array( _OFAV_noeg__Conf::$added_STYLE_Admin_Files ) ) {
     62            foreach ( _OFAV_noeg__Conf::$added_STYLE_Admin_Files as $style ) {
     63                if ( isset( $style[ 'hook_deps' ] ) ) {
     64                    if ( is_string( $style[ 'hook_deps' ] ) ) {
     65                        if ( strpos( $hook , trim( $style[ 'hook_deps' ] ) ) ) {
     66                            _OFAV_noeg__Main::addStyle( $style );
     67                        }
     68                    } else if ( is_array( $style[ 'hook_deps' ] ) ) {
     69                        foreach ( $style[ 'hook_deps' ] as $value ) {
     70                            if ( strpos( $hook , trim( $value ) ) !== false ) {
     71                                _OFAV_noeg__Main::addStyle( $style );
     72                                break;
     73                            }
     74                        }
     75                    }
     76                } else {
     77                    _OFAV_noeg__Main::addStyle( $style );
     78                }
    5479            }
    5580        };
    5681    }
    5782
     83/*
    5884    public function addMenuPage( $params = array( 'page_title' => null , 'menu_title' => null , 'capability' => null , 'menu_slug' => null , 'function' => null ) ) {
    5985        add_action( 'admin_menu', function() {
     
    7298        });
    7399    }
    74 
     100*/
    75101}
  • opes-favicon/trunk/inc/common/common.class.php

    r1065076 r1117983  
    11<?php
    22
    3 class Class_Common {
     3class _OFAV_noeg__Common {
    44
    55    private function __construct( $params ) {
    6         global $added_PHP_Common_Files;
     6        //global _OFAV_noeg__Conf::$added_PHP_Common_Files;
    77
    8         if ( is_array( $added_PHP_Common_Files ) ) {
    9             foreach ( $added_PHP_Common_Files as $filePath ) {
     8        if ( is_array( _OFAV_noeg__Conf::$added_PHP_Common_Files ) ) {
     9            foreach ( _OFAV_noeg__Conf::$added_PHP_Common_Files as $filePath ) {
    1010                include_once( $filePath );
    1111            }
    1212        }
    1313
    14         $directory = new RecursiveDirectoryIterator( _THIS_PLUGIN__COMMON_DIR_ . 'controller/' );
     14        $PHP_ToLoad = scandir( __OFAV_noeg__THIS_PLUGIN__COMMON_DIR_ . 'controller/' );
     15        $PHP_ToLoad = preg_grep( '/-ToLoad\.php$/i' , $PHP_ToLoad );
     16        sort ( $PHP_ToLoad , SORT_STRING );
     17
     18        foreach ( $PHP_ToLoad as $key => $fileName ) {
     19            include( __OFAV_noeg__THIS_PLUGIN__COMMON_DIR_ . 'controller/' . $fileName );
     20        }
     21/*
     22        $directory = new RecursiveDirectoryIterator( __OFAV_noeg__THIS_PLUGIN__COMMON_DIR_ . 'controller/' );
    1523        $recIterator = new RecursiveIteratorIterator($directory);
    16         $regex = new RegexIterator($recIterator, '/\.php$/i');
     24        $regex = new RegexIterator($recIterator, '/-ToLoad\.php$/i');
    1725       
    1826        foreach($regex as $item) {
    1927            include $item->getPathname();
    2028        }
    21 
     29*/
    2230        if ( is_admin() ) {
    2331            add_action( 'admin_enqueue_scripts', array( $this , 'addAddedScriptsAndStyles' ) );
     
    2836
    2937    public static function init( $params ) {
    30         return new Class_Common( $params );
     38        return new _OFAV_noeg__Common( $params );
    3139    }
    3240
    33     public function addAddedScriptsAndStyles() {
    34         global $added_SCRIPT_Common_Files , $added_STYLE_Common_Files;
     41    public function addAddedScriptsAndStyles( $hook ) {
     42        //global _OFAV_noeg__Conf::$added_SCRIPT_Common_Files , _OFAV_noeg__Conf::$added_STYLE_Common_Files;
    3543
    36         if ( is_array( $added_SCRIPT_Common_Files ) ) {
    37             foreach ( $added_SCRIPT_Common_Files as $script ) {
    38                 Class_Main::addScript( $script );
     44        if ( is_array( _OFAV_noeg__Conf::$added_SCRIPT_Common_Files ) ) {
     45            foreach ( _OFAV_noeg__Conf::$added_SCRIPT_Common_Files as $script ) {
     46                if ( isset( $script[ 'hook_deps' ] ) ) {
     47                    if ( is_string( $script[ 'hook_deps' ] ) ) {
     48                        if ( strpos( $hook , trim( $script[ 'hook_deps' ] ) ) ) {
     49                            _OFAV_noeg__Main::addScript( $script );
     50                        }
     51                    } else if ( is_array( $script[ 'hook_deps' ] ) ) {
     52                        foreach ( $script[ 'hook_deps' ] as $value ) {
     53                            if ( strpos( $hook , trim( $value ) ) !== false ) {
     54                                _OFAV_noeg__Main::addScript( $script );
     55                                break;
     56                            }
     57                        }
     58                    }
     59                } else {
     60                    _OFAV_noeg__Main::addScript( $script );
     61                }
    3962            }
    4063        };
    4164
    42         if ( is_array( $added_STYLE_Common_Files ) ) {
    43             foreach ( $added_STYLE_Common_Files as $style ) {
    44                 Class_Main::addStyle( $style );
     65        if ( is_array( _OFAV_noeg__Conf::$added_STYLE_Common_Files ) ) {
     66            foreach ( _OFAV_noeg__Conf::$added_STYLE_Common_Files as $style ) {
     67                if ( isset( $style[ 'hook_deps' ] ) ) {
     68                    if ( is_string( $style[ 'hook_deps' ] ) ) {
     69                        if ( strpos( $hook , trim( $style[ 'hook_deps' ] ) ) ) {
     70                            _OFAV_noeg__Main::addStyle( $style );
     71                        }
     72                    } else if ( is_array( $style[ 'hook_deps' ] ) ) {
     73                        foreach ( $style[ 'hook_deps' ] as $value ) {
     74                            if ( strpos( $hook , trim( $value ) ) !== false ) {
     75                                _OFAV_noeg__Main::addStyle( $style );
     76                                break;
     77                            }
     78                        }
     79                    }
     80                } else {
     81                    _OFAV_noeg__Main::addStyle( $style );
     82                }
    4583            }
    4684        };
  • opes-favicon/trunk/inc/front/front.class.php

    r1065076 r1117983  
    11<?php
    22
    3 class Class_Front {
     3class _OFAV_noeg__Front {
    44
    55    private function __construct( $params ) {
    6         global $added_PHP_Front_Files;
     6        //global _OFAV_noeg__Conf::$added_PHP_Front_Files;
    77
    8         if ( is_array( $added_PHP_Front_Files ) ) {
    9             foreach ( $added_PHP_Front_Files as $filePath ) {
     8        if ( is_array( _OFAV_noeg__Conf::$added_PHP_Front_Files ) ) {
     9            foreach ( _OFAV_noeg__Conf::$added_PHP_Front_Files as $filePath ) {
    1010                include_once( $filePath );
    1111            }
    1212        }
    13         $directory = new RecursiveDirectoryIterator( _THIS_PLUGIN__FRONT_DIR_ . 'controller/' );
     13
     14        $PHP_ToLoad = scandir( __OFAV_noeg__THIS_PLUGIN__FRONT_DIR_ . 'controller/' );
     15        $PHP_ToLoad = preg_grep( '/-ToLoad\.php$/i' , $PHP_ToLoad );
     16        sort ( $PHP_ToLoad , SORT_STRING );
     17
     18        foreach ( $PHP_ToLoad as $key => $fileName ) {
     19            include( __OFAV_noeg__THIS_PLUGIN__FRONT_DIR_ . 'controller/' . $fileName );
     20        }
     21/*
     22        $directory = new RecursiveDirectoryIterator( __OFAV_noeg__THIS_PLUGIN__FRONT_DIR_ . 'controller/' );
    1423        $recIterator = new RecursiveIteratorIterator($directory);
    15         $regex = new RegexIterator($recIterator, '/\.php$/i');
     24        $regex = new RegexIterator($recIterator, '/-ToLoad\.php$/i');
    1625
    1726        foreach($regex as $item) {
    1827            include $item->getPathname();
    1928        }
     29*/ 
    2030        add_action( 'wp_enqueue_scripts', array( $this , 'addAddedScriptsAndStyles' ) );
    2131    }
    2232
    2333    public static function init( $params ) {
    24         return new Class_Front( $params );
     34        return new _OFAV_noeg__Front( $params );
    2535    }
    2636
    27     public function addAddedScriptsAndStyles() {
    28         global $added_SCRIPT_Front_Files , $added_STYLE_Front_Files;
     37    public function addAddedScriptsAndStyles( $hook ) {
     38        //global _OFAV_noeg__Conf::$added_SCRIPT_Front_Files , _OFAV_noeg__Conf::$added_STYLE_Front_Files;
    2939
    30         if ( is_array( $added_SCRIPT_Front_Files ) ) {
    31             foreach ( $added_SCRIPT_Front_Files as $script ) {
    32                 Class_Main::addScript( $script );
     40        if ( is_array( _OFAV_noeg__Conf::$added_SCRIPT_Front_Files ) ) {
     41            foreach ( _OFAV_noeg__Conf::$added_SCRIPT_Front_Files as $script ) {
     42                if ( isset( $script[ 'hook_deps' ] ) ) {
     43                    if ( is_string( $script[ 'hook_deps' ] ) ) {
     44                        if ( strpos( $hook , trim( $script[ 'hook_deps' ] ) ) ) {
     45                            _OFAV_noeg__Main::addScript( $script );
     46                        }
     47                    } else if ( is_array( $script[ 'hook_deps' ] ) ) {
     48                        foreach ( $script[ 'hook_deps' ] as $value ) {
     49                            if ( strpos( $hook , trim( $value ) ) !== false ) {
     50                                _OFAV_noeg__Main::addScript( $script );
     51                                break;
     52                            }
     53                        }
     54                    }
     55                } else {
     56                    _OFAV_noeg__Main::addScript( $script );
     57                }
    3358            }
    3459        };
    3560
    36         if ( is_array( $added_STYLE_Front_Files ) ) {
    37             foreach ( $added_STYLE_Front_Files as $style ) {
    38                 Class_Main::addStyle( $style );
     61        if ( is_array( _OFAV_noeg__Conf::$added_STYLE_Front_Files ) ) {
     62            foreach ( _OFAV_noeg__Conf::$added_STYLE_Front_Files as $style ) {
     63                if ( isset( $style[ 'hook_deps' ] ) ) {
     64                    if ( is_string( $style[ 'hook_deps' ] ) ) {
     65                        if ( strpos( $hook , trim( $style[ 'hook_deps' ] ) ) ) {
     66                            _OFAV_noeg__Main::addStyle( $style );
     67                        }
     68                    } else if ( is_array( $style[ 'hook_deps' ] ) ) {
     69                        foreach ( $style[ 'hook_deps' ] as $value ) {
     70                            if ( strpos( $hook , trim( $value ) ) !== false ) {
     71                                _OFAV_noeg__Main::addStyle( $style );
     72                                break;
     73                            }
     74                        }
     75                    }
     76                } else {
     77                    _OFAV_noeg__Main::addStyle( $style );
     78                }
    3979            }
    4080        };
  • opes-favicon/trunk/inc/main.class.php

    r1065076 r1117983  
    11<?php
    22
    3 require_once _THIS_PLUGIN__DIR_ . "inc/common/common.class.php";
    4 
    5 class Class_Main {
     3require_once __OFAV_noeg__THIS_PLUGIN__DIR_ . "inc/common/common.class.php";
     4
     5class _OFAV_noeg__Main {
    66
    77    private $adminClassFile = 'admin.class.php';
     
    1313    private $frontInstance = false;
    1414
     15    private $defIfScreenPropCondOperator = 'OR';
     16   
     17    private $defIfCondType = 'CONTAIN';
     18    private $defIfCondOperator = 'OR';
     19
     20    public function generateContainStringIfCond( $contain ) {
     21        if ( is_array( $contain ) ) {
     22            $func = $contain[ 'function' ];
     23            $where = $contain[ 'where' ];
     24            $what =  $contain[ 'what' ];
     25            return "$func( $where , $what )";
     26        } else {
     27            return '1 == 1';
     28        }
     29    }
     30
    1531    private function __construct( $params ) {
    16         if ( !is_a( $this->commonInstance , 'Class_Common' ) ) {
    17             $this->commonInstance = Class_Common::init( array() );
     32        if ( !is_a( $this->commonInstance , '_OFAV_noeg__Common' ) ) {
     33            $this->commonInstance = _OFAV_noeg__Common::init( array() );
    1834        };
    1935
    2036        if ( is_admin() ) {
    21             require_once _THIS_PLUGIN__ADMIN_DIR_ . $this->adminClassFile;
     37            require_once __OFAV_noeg__THIS_PLUGIN__ADMIN_DIR_ . $this->adminClassFile;
    2238           
    2339            add_action( 'admin_enqueue_scripts', array( $this , 'addDafeultCommonScriptsAndStyles' ) );
    2440            add_action( 'admin_enqueue_scripts', array( $this , 'addDafeultAdminScriptsAndStyles' ) );
    2541
    26             if ( !is_a( $this->adminInstance , 'Class_Admin' ) ) {
    27                 $this->adminInstance = Class_Admin::init( array() );
     42            if ( !is_a( $this->adminInstance , '_OFAV_noeg__Admin' ) ) {
     43                $this->adminInstance = _OFAV_noeg__Admin::init( array() );
    2844            };
    2945        } else {
    30             require_once _THIS_PLUGIN__FRONT_DIR_ . $this->frontClassFile;
     46            require_once __OFAV_noeg__THIS_PLUGIN__FRONT_DIR_ . $this->frontClassFile;
    3147
    3248            add_action( 'wp_enqueue_scripts', array( $this , 'addDafeultCommonScriptsAndStyles' ) );
    3349            add_action( 'wp_enqueue_scripts', array( $this , 'addDafeultFrontScriptsAndStyles' ) );
    3450
    35             if ( !is_a( $this->frontInstance , 'Class_Front' ) ) {
    36                 $this->frontInstance = Class_Front::init( array() );
     51            if ( !is_a( $this->frontInstance , '_OFAV_noeg__Front' ) ) {
     52                $this->frontInstance = _OFAV_noeg__Front::init( array() );
    3753            };
    3854        }
     
    4056
    4157    public static function init( $params ) {
    42         return new Class_Main( $params );
     58        return new _OFAV_noeg__Main( $params );
    4359    }
    4460
     
    89105    public static function addScript( $paramsIn ) {
    90106        if ( is_array( $paramsIn ) && isset( $paramsIn[ 'handle' ] ) && isset( $paramsIn[ 'src' ] ) && !empty( $paramsIn[ 'handle' ] ) && !empty( $paramsIn[ 'src' ] ) ) {
    91             return ( Class_Main::registerScript( $paramsIn ) && Class_Main::enqueueScript( $paramsIn[ 'handle' ] ) );
     107            if ( _OFAV_noeg__Main::registerScript( $paramsIn ) && _OFAV_noeg__Main::enqueueScript( $paramsIn[ 'handle' ] ) ) {
     108
     109                if ( isset( $paramsIn[ 'localize' ] ) && is_array( $paramsIn[ 'localize' ] ) ) {
     110                    foreach ( $paramsIn[ 'localize' ] as $name => $value ) {
     111                        wp_localize_script( $paramsIn[ 'handle' ] , $name , $value );
     112                    }
     113                }
     114
     115                return true;
     116            } else {
     117                return false;
     118            }
    92119        } else {
    93120            return false;
     
    97124    public static function addStyle( $paramsIn ) {
    98125        if ( is_array( $paramsIn ) && isset( $paramsIn[ 'handle' ] ) && isset( $paramsIn[ 'src' ] ) && !empty( $paramsIn[ 'handle' ] ) && !empty( $paramsIn[ 'src' ] ) ) {
    99             return ( Class_Main::registerStyle( $paramsIn ) && Class_Main::enqueueStyle( $paramsIn[ 'handle' ] ) );
     126            return ( _OFAV_noeg__Main::registerStyle( $paramsIn ) && _OFAV_noeg__Main::enqueueStyle( $paramsIn[ 'handle' ] ) );
    100127        } else {
    101128            return false;
     
    103130    }
    104131
    105     public function addDafeultCommonScriptsAndStyles() {
    106         global $defaultScriptsAndStyles;
     132    public function addDafeultCommonScriptsAndStyles( $hook ) {
     133        //global _OFAV_noeg__Conf::$defaultScriptsAndStyles;
    107134        $space = 'common';
    108135
    109         if ( is_array( $defaultScriptsAndStyles ) && isset( $defaultScriptsAndStyles[ $space ] ) ) {
    110             if ( is_array( $defaultScriptsAndStyles[ $space ] ) ) {
    111                 if ( isset( $defaultScriptsAndStyles[ $space ][ 'js' ] ) && is_array( $defaultScriptsAndStyles[ $space ][ 'js' ] ) ) {
     136        if ( is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles ) && isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ] ) ) {
     137            if ( is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ] ) ) {
     138                if ( isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] ) && is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] ) ) {
    112139                    $type = 'js/';
    113 
    114                     foreach ( $defaultScriptsAndStyles[ $space ][ 'js' ] as $script ) {
    115                         $script[ 'src' ] = _THIS_PLUGIN__COMMON_URL_ . 'assets/' . $type . $script[ 'src' ];
    116                         $this->addScript( $script );
    117                     }
    118                 }
    119                 if ( isset( $defaultScriptsAndStyles[ $space ][ 'css' ] ) && is_array( $defaultScriptsAndStyles[ $space ][ 'css' ] ) ) {
     140                   
     141                    foreach ( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] as $script ) {
     142                        $script[ 'src' ] = __OFAV_noeg__THIS_PLUGIN__COMMON_URL_ . 'assets/' . $type . $script[ 'src' ];
     143                        if ( isset( $script[ 'hook_deps' ] ) ) {
     144                            if ( is_string( $script[ 'hook_deps' ] ) ) {
     145                                if ( strpos( $hook , trim( $script[ 'hook_deps' ] ) ) ) {
     146                                    $this->addScript( $script );
     147                                }
     148                            } else if ( is_array( $script[ 'hook_deps' ] ) ) {
     149                                foreach ( $script[ 'hook_deps' ] as $value ) {
     150                                    if ( strpos( $hook , trim( $value ) ) !== false ) {
     151                                        $this->addScript( $script );
     152                                        break;
     153                                    }
     154                                }
     155                            }
     156                        } else {
     157                            $this->addScript( $script );
     158                        }
     159                    }
     160                }
     161                if ( isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] ) && is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] ) ) {
    120162                    $type = 'css/';
    121163
    122                     foreach ( $defaultScriptsAndStyles[ $space ][ 'css' ] as $style ) {
    123                         $style[ 'src' ] = _THIS_PLUGIN__COMMON_URL_ . 'assets/' . $type . $style[ 'src' ];
    124                         $this->addStyle( $style );
     164                    foreach ( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] as $style ) {
     165                        $style[ 'src' ] = __OFAV_noeg__THIS_PLUGIN__COMMON_URL_ . 'assets/' . $type . $style[ 'src' ];
     166                        if ( isset( $style[ 'hook_deps' ] ) ) {
     167                            if ( is_string( $style[ 'hook_deps' ] ) ) {
     168                                if ( strpos( $hook , trim( $style[ 'hook_deps' ] ) ) ) {
     169                                    $this->addStyle( $style );
     170                                }
     171                            } else if ( is_array( $style[ 'hook_deps' ] ) ) {
     172                                foreach ( $style[ 'hook_deps' ] as $value ) {
     173                                    if ( strpos( $hook , trim( $value ) ) !== false ) {
     174                                        $this->addStyle( $style );
     175                                        break;
     176                                    }
     177                                }
     178                            }
     179                        } else {
     180                            $this->addStyle( $style );
     181                        }
    125182                    }
    126183                }
     
    129186    }
    130187
    131     public function addDafeultAdminScriptsAndStyles() {
    132         global $defaultScriptsAndStyles;
     188    public function addDafeultAdminScriptsAndStyles( $hook ) {
     189        //global _OFAV_noeg__Conf::$defaultScriptsAndStyles;
    133190        $space = 'admin';
    134191
    135         if ( is_array( $defaultScriptsAndStyles ) && isset( $defaultScriptsAndStyles[ $space ] ) ) {
    136             if ( is_array( $defaultScriptsAndStyles[ $space ] ) ) {
    137                 if ( isset( $defaultScriptsAndStyles[ $space ][ 'js' ] ) && is_array( $defaultScriptsAndStyles[ $space ][ 'js' ] ) ) {
    138                     //echo 'js'.'<br>';
     192        if ( is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles ) && isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ] ) ) {
     193            if ( is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ] ) ) {
     194                if ( isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] ) && is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] ) ) {
    139195                    $type = 'js/';
    140196
    141                     foreach ( $defaultScriptsAndStyles[ $space ][ 'js' ] as $script ) {
    142                         $script[ 'src' ] = _THIS_PLUGIN__ADMIN_URL_ . 'assets/' . $type . $script[ 'src' ];
    143                         $this->addScript( $script );
    144                     }
    145                 }
    146                 if ( isset( $defaultScriptsAndStyles[ $space ][ 'css' ] ) && is_array( $defaultScriptsAndStyles[ $space ][ 'css' ] ) ) {
    147                     //echo 'css'.'<br>';
     197                    foreach ( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] as $script ) {
     198                        $script[ 'src' ] = __OFAV_noeg__THIS_PLUGIN__ADMIN_URL_ . 'assets/' . $type . $script[ 'src' ];
     199                        if ( isset( $script[ 'hook_deps' ] ) ) {
     200                            if ( is_string( $script[ 'hook_deps' ] ) ) {
     201                                if ( strpos( $hook , trim( $script[ 'hook_deps' ] ) ) ) {
     202                                    $this->addScript( $script );
     203                                }
     204                            } else if ( is_array( $script[ 'hook_deps' ] ) ) {
     205                                foreach ( $script[ 'hook_deps' ] as $value ) {
     206                                    if ( strpos( $hook , trim( $value ) ) !== false ) {
     207                                        $this->addScript( $script );
     208                                        break;
     209                                    }
     210                                }
     211                            }
     212                        } else {
     213                            $this->addScript( $script );
     214                        }
     215                    }
     216                }
     217                if ( isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] ) && is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] ) ) {
    148218                    $type = 'css/';
    149 
    150                     foreach ( $defaultScriptsAndStyles[ $space ][ 'css' ] as $style ) {
    151                         $style[ 'src' ] = _THIS_PLUGIN__ADMIN_URL_ . 'assets/' . $type . $style[ 'src' ];
    152                         $this->addStyle( $style );
     219                    foreach ( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] as $style ) {
     220                        $style[ 'src' ] = __OFAV_noeg__THIS_PLUGIN__ADMIN_URL_ . 'assets/' . $type . $style[ 'src' ];
     221                        if ( isset( $style[ 'hook_deps' ] ) ) {
     222                            if ( is_string( $style[ 'hook_deps' ] ) ) {
     223                                if ( strpos( $hook , trim( $style[ 'hook_deps' ] ) ) ) {
     224                                    $this->addStyle( $style );
     225                                }
     226                            } else if ( is_array( $style[ 'hook_deps' ] ) ) {
     227                                foreach ( $style[ 'hook_deps' ] as $value ) {
     228                                    if ( strpos( $hook , trim( $value ) ) !== false ) {
     229                                        $this->addStyle( $style );
     230                                        break;
     231                                    }
     232                                }
     233                            }
     234                        } else {
     235                            $this->addStyle( $style );
     236                        }
    153237                    }
    154238                }
     
    157241    }
    158242
    159     public function addDafeultFrontScriptsAndStyles() {
    160         global $defaultScriptsAndStyles;
     243    public function addDafeultFrontScriptsAndStyles( $hook ) {
     244        //global _OFAV_noeg__Conf::$defaultScriptsAndStyles;
    161245        $space = 'front';
    162246
    163         if ( is_array( $defaultScriptsAndStyles ) && isset( $defaultScriptsAndStyles[ $space ] ) ) {
    164             if ( is_array( $defaultScriptsAndStyles[ $space ] ) ) {
    165                 if ( isset( $defaultScriptsAndStyles[ $space ][ 'js' ] ) && is_array( $defaultScriptsAndStyles[ $space ][ 'js' ] ) ) {
     247        if ( is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles ) && isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ] ) ) {
     248            if ( is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ] ) ) {
     249                if ( isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] ) && is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] ) ) {
    166250                    $type = 'js/';
    167251
    168                     foreach ( $defaultScriptsAndStyles[ $space ][ 'js' ] as $script ) {
    169                         $script[ 'src' ] = _THIS_PLUGIN__FRONT_URL_ . 'assets/' . $type . $script[ 'src' ];
    170                         $this->addScript( $script );
    171                     }
    172                 }
    173                 if ( isset( $defaultScriptsAndStyles[ $space ][ 'css' ] ) && is_array( $defaultScriptsAndStyles[ $space ][ 'css' ] ) ) {
     252                    foreach ( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'js' ] as $script ) {
     253                        $script[ 'src' ] = __OFAV_noeg__THIS_PLUGIN__FRONT_URL_ . 'assets/' . $type . $script[ 'src' ];
     254                        if ( isset( $script[ 'hook_deps' ] ) ) {
     255                            if ( is_string( $script[ 'hook_deps' ] ) ) {
     256                                if ( strpos( $hook , trim( $script[ 'hook_deps' ] ) ) ) {
     257                                    $this->addScript( $script );
     258                                }
     259                            } else if ( is_array( $script[ 'hook_deps' ] ) ) {
     260                                foreach ( $script[ 'hook_deps' ] as $value ) {
     261                                    if ( strpos( $hook , trim( $value ) ) !== false ) {
     262                                        $this->addScript( $script );
     263                                        break;
     264                                    }
     265                                }
     266                            }
     267                        } else {
     268                            $this->addScript( $script );
     269                        }
     270                    }
     271                }
     272                if ( isset( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] ) && is_array( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] ) ) {
    174273                    $type = 'css/';
    175274
    176                     foreach ( $defaultScriptsAndStyles[ $space ][ 'css' ] as $style ) {
    177                         $style[ 'src' ] = _THIS_PLUGIN__FRONT_URL_ . 'assets/' . $type . $style[ 'src' ];
    178                         $this->addStyle( $style );
     275                    foreach ( _OFAV_noeg__Conf::$defaultScriptsAndStyles[ $space ][ 'css' ] as $style ) {
     276                        $style[ 'src' ] = __OFAV_noeg__THIS_PLUGIN__FRONT_URL_ . 'assets/' . $type . $style[ 'src' ];
     277                        if ( isset( $style[ 'hook_deps' ] ) ) {
     278                            if ( is_string( $style[ 'hook_deps' ] ) ) {
     279                                if ( strpos( $hook , trim( $style[ 'hook_deps' ] ) ) ) {
     280                                    $this->addStyle( $style );
     281                                }
     282                            } else if ( is_array( $style[ 'hook_deps' ] ) ) {
     283                                foreach ( $style[ 'hook_deps' ] as $value ) {
     284                                    if ( strpos( $hook , trim( $value ) ) !== false ) {
     285                                        $this->addStyle( $style );
     286                                        break;
     287                                    }
     288                                }
     289                            }
     290                        } else {
     291                            $this->addStyle( $style );
     292                        }
    179293                    }
    180294                }
  • opes-favicon/trunk/opes-favicon.php

    r1065243 r1117983  
    77Plugin URI: https://wordpress.org/plugins/opes-favicon/
    88Description: This plugin allows you to add and manage a favicon on your WordPress website.
    9 Version: 2.1.2
     9Version: 3.0.0
    1010Author: Paweł Twardziak
    1111Author URI: http://it-opes.com/
     
    3030*/
    3131
    32 define( '_DS_' , DIRECTORY_SEPARATOR );
    33 define( '_PS_' , '/' );
    34 define( '_THIS_PLUGIN__VERSION_' , '2.1.2' );
    35 define( '_THIS_PLUGIN__MAIN_FILE_' , __FILE__ );
    36 define( '_THIS_PLUGIN__TEXT_DOMAIN_' , 'opes_favicon' );
     32define( '__OFAV_noeg__DS_' , DIRECTORY_SEPARATOR );
     33define( '__OFAV_noeg__PS_' , '/' );
     34define( '__OFAV_noeg__THIS_PLUGIN__VERSION_' , '3.0.0' );
     35define( '__OFAV_noeg__THIS_PLUGIN__MAIN_FILE_' , __FILE__ );
     36define( '__OFAV_noeg__THIS_PLUGIN__TEXT_DOMAIN_' , '__OFAV_noeg__' );
    3737
    38 define( '_THIS_PLUGIN__DIR_' , plugin_dir_path( __FILE__ ) );
    39 define( '_THIS_PLUGIN__INC_DIR_' , _THIS_PLUGIN__DIR_ . 'inc' . _DS_ );
    40 define( '_THIS_PLUGIN__COMMON_DIR_' , _THIS_PLUGIN__INC_DIR_ . 'common' . _DS_ );
    41 define( '_THIS_PLUGIN__ADMIN_DIR_' , _THIS_PLUGIN__INC_DIR_ . 'admin' . _DS_ );
    42 define( '_THIS_PLUGIN__FRONT_DIR_' , _THIS_PLUGIN__INC_DIR_ . 'front' . _DS_ );
     38define( '__OFAV_noeg__THIS_PLUGIN__ADMINAJAX_' , admin_url( 'admin-ajax.php' ) );
     39define( '__OFAV_noeg__THIS_PLUGIN__DB_VERSION_' , __OFAV_noeg__THIS_PLUGIN__VERSION_ );
    4340
    44 define( '_THIS_PLUGIN__URL_' , plugin_dir_url( __FILE__ ) );
    45 define( '_THIS_PLUGIN__INC_URL_' , _THIS_PLUGIN__URL_ . 'inc' . _DS_ );
    46 define( '_THIS_PLUGIN__COMMON_URL_' , _THIS_PLUGIN__INC_URL_ . 'common' . _DS_ );
    47 define( '_THIS_PLUGIN__ADMIN_URL_' , _THIS_PLUGIN__INC_URL_ . 'admin' . _DS_ );
    48 define( '_THIS_PLUGIN__FRONT_URL_' , _THIS_PLUGIN__INC_URL_ . 'front' . _DS_ );
     41define( '__OFAV_noeg__THIS_PLUGIN__DIR_' , /*plugin_dir_path( __FILE__ )*/dirname( __FILE__ ) . __OFAV_noeg__DS_ );
     42define( '__OFAV_noeg__THIS_PLUGIN__INC_DIR_' , __OFAV_noeg__THIS_PLUGIN__DIR_ . 'inc' . __OFAV_noeg__DS_ );
     43define( '__OFAV_noeg__THIS_PLUGIN__COMMON_DIR_' , __OFAV_noeg__THIS_PLUGIN__INC_DIR_ . 'common' . __OFAV_noeg__DS_ );
     44define( '__OFAV_noeg__THIS_PLUGIN__ADMIN_DIR_' , __OFAV_noeg__THIS_PLUGIN__INC_DIR_ . 'admin' . __OFAV_noeg__DS_ );
     45define( '__OFAV_noeg__THIS_PLUGIN__FRONT_DIR_' , __OFAV_noeg__THIS_PLUGIN__INC_DIR_ . 'front' . __OFAV_noeg__DS_ );
    4946
    50 require_once _THIS_PLUGIN__DIR_ . "conf.php";
    51 require_once _THIS_PLUGIN__INC_DIR_ . "main.class.php";
     47define( '__OFAV_noeg__THIS_PLUGIN__URL_' , plugin_dir_url( __FILE__ ) );
     48define( '__OFAV_noeg__THIS_PLUGIN__INC_URL_' , __OFAV_noeg__THIS_PLUGIN__URL_ . 'inc' . __OFAV_noeg__PS_ );
     49define( '__OFAV_noeg__THIS_PLUGIN__COMMON_URL_' , __OFAV_noeg__THIS_PLUGIN__INC_URL_ . 'common' . __OFAV_noeg__PS_ );
     50define( '__OFAV_noeg__THIS_PLUGIN__ADMIN_URL_' , __OFAV_noeg__THIS_PLUGIN__INC_URL_ . 'admin' . __OFAV_noeg__PS_ );
     51define( '__OFAV_noeg__THIS_PLUGIN__FRONT_URL_' , __OFAV_noeg__THIS_PLUGIN__INC_URL_ . 'front' . __OFAV_noeg__PS_ );
    5252
    53 $Class_Main = Class_Main::init( array() );
     53require_once __OFAV_noeg__THIS_PLUGIN__DIR_ . "conf.php";
     54require_once __OFAV_noeg__THIS_PLUGIN__INC_DIR_ . "main.class.php";
     55
     56_OFAV_noeg__Main::init( array() );
    5457
    5558
  • opes-favicon/trunk/readme.txt

    r1065261 r1117983  
    44Requires at least: 3.5.0
    55Tested up to: 4.1
    6 Stable tag: 2.1.2
     6Stable tag: 3.0.0
    77License: GPLv2 or later
    88
     
    2828
    2929== Changelog ==
     30
     31= 3.0.0 =
     32*Release Date - 22th March, 2015*
     33
     34* New code architecture
     35* Fix duplicate class error
    3036
    3137= 2.1.2 =
Note: See TracChangeset for help on using the changeset viewer.