Changed plugins_url to tools_url to facilitate move of tz-tools to wp-content
Showing
5 changed files
with
18 additions
and
10 deletions
| ... | @@ -7,7 +7,7 @@ class Branding { | ... | @@ -7,7 +7,7 @@ class Branding { |
| 7 | 7 | ||
| 8 | class Branding_Actions { | 8 | class Branding_Actions { |
| 9 | public static function admin_print_styles() { | 9 | public static function admin_print_styles() { |
| 10 | _enqueue_style('branding-style', plugins_url('css/tenzing.css', __FILE__)); | 10 | _enqueue_style('branding-style', TzTools::tools_url('css/tenzing.css', __FILE__)); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | public static function admin_head() { | 13 | public static function admin_head() { |
| ... | @@ -22,7 +22,7 @@ class Branding_Actions { | ... | @@ -22,7 +22,7 @@ class Branding_Actions { |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | public static function login_head() { | 24 | public static function login_head() { |
| 25 | echo '<link rel="stylesheet" type="text/css" href="' . plugins_url('css/tz_login.css', __FILE__) . '" />'; | 25 | echo '<link rel="stylesheet" type="text/css" href="' . TzTools::tools_url('css/tz_login.css', __FILE__) . '" />'; |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| 28 | 28 | ... | ... |
| ... | @@ -285,7 +285,7 @@ class PagePermissions_Actions { | ... | @@ -285,7 +285,7 @@ class PagePermissions_Actions { |
| 285 | ob_end_clean(); | 285 | ob_end_clean(); |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | _enqueue_script('page-permissions', plugins_url('PagePermissions.js', __FILE__)); | 288 | _enqueue_script('page-permissions', TzTools::tools_url('PagePermissions.js', __FILE__)); |
| 289 | _localize_script('page-permissions', 'TzPagePermissionsData', Array( | 289 | _localize_script('page-permissions', 'TzPagePermissionsData', Array( |
| 290 | 'trigger' => PagePermissions::ELE_SEL | 290 | 'trigger' => PagePermissions::ELE_SEL |
| 291 | , 'focus' => PagePermissions::OPT_CUST | 291 | , 'focus' => PagePermissions::OPT_CUST | ... | ... |
| ... | @@ -110,7 +110,7 @@ class ShortCodes_Actions { | ... | @@ -110,7 +110,7 @@ class ShortCodes_Actions { |
| 110 | 110 | ||
| 111 | public static function admin_print_scripts() { | 111 | public static function admin_print_scripts() { |
| 112 | if ($GLOBALS['editing']) { | 112 | if ($GLOBALS['editing']) { |
| 113 | _enqueue_script('shortcoder', plugins_url('shortcoder.js', __FILE__), Array('jquery')); | 113 | _enqueue_script('shortcoder', TzTools::tools_url('shortcoder.js', __FILE__), Array('jquery')); |
| 114 | 114 | ||
| 115 | echo "<script type=\"text/javascript\">\n/* <![CDATA[ */\n"; | 115 | echo "<script type=\"text/javascript\">\n/* <![CDATA[ */\n"; |
| 116 | echo 'var TzRegisteredShortCodes = ' . json_encode(ShortCodes::getRegistered()); | 116 | echo 'var TzRegisteredShortCodes = ' . json_encode(ShortCodes::getRegistered()); | ... | ... |
| ... | @@ -4,7 +4,7 @@ class MenuWidget extends WP_Widget { | ... | @@ -4,7 +4,7 @@ class MenuWidget extends WP_Widget { |
| 4 | register_widget(__CLASS__); | 4 | register_widget(__CLASS__); |
| 5 | 5 | ||
| 6 | if (is_admin()) { | 6 | if (is_admin()) { |
| 7 | _enqueue_script('tz-menu-widget', plugins_url('MenuWidget.js', __FILE__), Array('addEvent')); | 7 | _enqueue_script('tz-menu-widget', TzTools::tools_url('MenuWidget.js', __FILE__), Array('addEvent')); |
| 8 | } | 8 | } |
| 9 | } | 9 | } |
| 10 | 10 | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | /* | 2 | /* |
| 3 | Plugin Name: Tenzing Tools | 3 | Plugin Name: Tenzing Tools |
| 4 | Version: 0.1 | 4 | Version: 0.3b |
| 5 | Description: Various classes to help out with stuff | 5 | Description: Various classes and functions to help out with stuff |
| 6 | Author: Tenzing | 6 | Author: Tenzing |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| ... | @@ -18,9 +18,9 @@ class TzTools { | ... | @@ -18,9 +18,9 @@ class TzTools { |
| 18 | 18 | ||
| 19 | require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'wp_functions.php'); | 19 | require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'wp_functions.php'); |
| 20 | 20 | ||
| 21 | _register_script('addEvent', plugins_url('addEvent.js', __FILE__)); | 21 | _register_script('addEvent', self::tools_url('addEvent.js', __FILE__)); |
| 22 | _register_script('xmlhttpHandler', plugins_url('xmlhttpHandler.js', __FILE__)); | 22 | _register_script('xmlhttpHandler', self::tools_url('xmlhttpHandler.js', __FILE__)); |
| 23 | _register_script('fireEvent', plugins_url('fireEvent.js', __FILE__)); | 23 | _register_script('fireEvent', self::tools_url('fireEvent.js', __FILE__)); |
| 24 | 24 | ||
| 25 | add_action('widgets_init', Array('MenuWidget', 'init')); | 25 | add_action('widgets_init', Array('MenuWidget', 'init')); |
| 26 | self::import('ShortCodes'); | 26 | self::import('ShortCodes'); |
| ... | @@ -40,6 +40,14 @@ class TzTools { | ... | @@ -40,6 +40,14 @@ class TzTools { |
| 40 | include($file); | 40 | include($file); |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | |||
| 44 | public static function tools_url($script, $base_file = false) { | ||
| 45 | $base_dir = (false === $base_file ? dirname(__FILE__) : dirname($base_file)); | ||
| 46 | $rel_path = str_replace(ABSPATH, '', $base_dir); | ||
| 47 | $script = site_url() . '/' . $rel_path . '/' . $script; | ||
| 48 | |||
| 49 | return $script; | ||
| 50 | } | ||
| 43 | } | 51 | } |
| 44 | 52 | ||
| 45 | function add_actions($class) { | 53 | function add_actions($class) { | ... | ... |
-
Please register or sign in to post a comment