Fixed some namespace bugs
Showing
2 changed files
with
15 additions
and
9 deletions
| 1 | <?php | 1 | <?php |
| 2 | |||
| 3 | use Tz\WordPress\Tools\ShortCodes; | ||
| 4 | use Tz\WordPress\Tools; | ||
| 5 | |||
| 2 | //error_reporting(E_ALL); | 6 | //error_reporting(E_ALL); |
| 3 | 7 | ||
| 4 | /* | 8 | /* |
| ... | @@ -27,8 +31,8 @@ class HybridGallery { | ... | @@ -27,8 +31,8 @@ class HybridGallery { |
| 27 | $role = get_role('administrator'); | 31 | $role = get_role('administrator'); |
| 28 | $role->add_cap(self::CAPABILITY); | 32 | $role->add_cap(self::CAPABILITY); |
| 29 | 33 | ||
| 30 | self::$widget_dir = TzTools::tools_url('./', __FILE__); | 34 | self::$widget_dir = Tools\url('./', __FILE__); |
| 31 | self::$upload_dir = dirname(__FILE__).'/uploads/'; | 35 | self::$upload_dir = __DIR__.'/uploads/'; |
| 32 | 36 | ||
| 33 | require('inc/config.php'); | 37 | require('inc/config.php'); |
| 34 | self::$defaults = $config; | 38 | self::$defaults = $config; |
| ... | @@ -39,10 +43,10 @@ class HybridGallery { | ... | @@ -39,10 +43,10 @@ class HybridGallery { |
| 39 | $mArr[$option] = $items[0]; | 43 | $mArr[$option] = $items[0]; |
| 40 | } | 44 | } |
| 41 | 45 | ||
| 42 | self::$WP_Settings = new WP_Option(self::SETTINGS_NS, $mArr); | 46 | self::$WP_Settings = new \WP_Option(self::SETTINGS_NS, $mArr); |
| 43 | 47 | ||
| 44 | ShortCodes::registerClass('HybridGallery_ShortCodes'); | 48 | ShortCodes\registerClass('HybridGallery_ShortCodes'); |
| 45 | add_actions('HybridGallery_Actions'); | 49 | Tools\add_actions('HybridGallery_Actions'); |
| 46 | } | 50 | } |
| 47 | 51 | ||
| 48 | public static function adminDisplay() { | 52 | public static function adminDisplay() { |
| ... | @@ -97,8 +101,8 @@ class HybridGallery_Actions { | ... | @@ -97,8 +101,8 @@ class HybridGallery_Actions { |
| 97 | public static function wp_print_scripts() { | 101 | public static function wp_print_scripts() { |
| 98 | wp_enqueue_script('jquery'); | 102 | wp_enqueue_script('jquery'); |
| 99 | wp_enqueue_script('jquery-form'); | 103 | wp_enqueue_script('jquery-form'); |
| 100 | _enqueue_script('swfobject', TzTools::tools_url('assets/uploadify/swfobject.js', __FILE__), array('jquery')); | 104 | _enqueue_script('swfobject', Tools\url('assets/uploadify/swfobject.js', __FILE__), array('jquery')); |
| 101 | _enqueue_script('jquery-uploadify', TzTools::tools_url('assets/uploadify/jquery.uploadify.v2.1.0.js', __FILE__), array('jquery','swfobject')); | 105 | _enqueue_script('jquery-uploadify', Tools\url('assets/uploadify/jquery.uploadify.v2.1.0.js', __FILE__), array('jquery','swfobject')); |
| 102 | } | 106 | } |
| 103 | 107 | ||
| 104 | } | 108 | } |
| ... | @@ -109,7 +113,7 @@ class HybridGallery_ShortCodes { | ... | @@ -109,7 +113,7 @@ class HybridGallery_ShortCodes { |
| 109 | 113 | ||
| 110 | public static function HybridGallery($args = array(), $content, $tag) { | 114 | public static function HybridGallery($args = array(), $content, $tag) { |
| 111 | 115 | ||
| 112 | $WP_Settings = new WP_Option(HybridGallery::SETTINGS_NS); | 116 | $WP_Settings = new \WP_Option(HybridGallery::SETTINGS_NS); |
| 113 | 117 | ||
| 114 | foreach (HybridGallery::$defaults as $key => $val) { | 118 | foreach (HybridGallery::$defaults as $key => $val) { |
| 115 | if (isset($WP_Settings[$key])) { | 119 | if (isset($WP_Settings[$key])) { | ... | ... |
| ... | @@ -4,6 +4,8 @@ namespace Tz\WordPress\Tools\ShortCodes; | ... | @@ -4,6 +4,8 @@ namespace Tz\WordPress\Tools\ShortCodes; |
| 4 | 4 | ||
| 5 | use Tz\WordPress\Tools; | 5 | use Tz\WordPress\Tools; |
| 6 | 6 | ||
| 7 | use WP_Option; | ||
| 8 | |||
| 7 | use \ReflectionClass, \ReflectionMethod, \ReflectionFunction; | 9 | use \ReflectionClass, \ReflectionMethod, \ReflectionFunction; |
| 8 | use \Exception; | 10 | use \Exception; |
| 9 | 11 | ||
| ... | @@ -31,7 +33,7 @@ function add_shortcodes($class) { | ... | @@ -31,7 +33,7 @@ function add_shortcodes($class) { |
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | function registerClass($class) { | 35 | function registerClass($class) { |
| 34 | call_user_func('add_shortcodes', $class); | 36 | call_user_func(__NAMESPACE__ . '\add_shortcodes', $class); |
| 35 | } | 37 | } |
| 36 | 38 | ||
| 37 | function add($code, $callback) { | 39 | function add($code, $callback) { | ... | ... |
-
Please register or sign in to post a comment