Created
September 16, 2010 15:06
-
-
Save scribu/582573 to your computer and use it in GitHub Desktop.
tabbed widgets fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: tabbed-widgets.php | |
=================================================================== | |
--- tabbed-widgets.php (revision 290262) | |
+++ tabbed-widgets.php (working copy) | |
@@ -13,25 +13,18 @@ | |
// Option row where we store widget copies, as other plugins (such as widget context) might take them over | |
define('ORIGINAL_WIDGETS', 'tabbed_widgets_originals'); | |
-// Necessary for the javascript to work | |
-$root = dirname(dirname(dirname(dirname(__FILE__)))); | |
-if (file_exists($root . '/wp-load.php')) | |
- require_once($root . '/wp-load.php'); | |
- | |
// Start the engine | |
-if (isset($_GET['returnjs'])) | |
- new tabbedWidgets(true); // Return JS | |
-else | |
- new tabbedWidgets(); | |
+new tabbedWidgets(); | |
- | |
class tabbedWidgets { | |
var $debbug_enabled = true; | |
var $tabbed_widget_content = array(); | |
var $stored_widgets = array(); | |
var $plugin_path = ''; | |
- | |
- function tabbedWidgets($printjsvars = false) { | |
+ | |
+ function tabbedWidgets() { | |
+ $printjsvars = isset($_GET['tabbedwidgets_returnjs']); | |
+ | |
$this->plugin_path = WP_CONTENT_URL . '/plugins/'. plugin_basename(dirname(__FILE__)) . '/'; | |
if (!$printjsvars) { | |
@@ -123,7 +116,7 @@ | |
wp_enqueue_script('jquery-ui-accordion', $this->plugin_path . 'js/jquery-ui-accordion.min.js', array('jquery', 'jquery-ui-core')); | |
wp_enqueue_script('jquery-ui-cookie', $this->plugin_path . 'js/jquery-cookie.min.js', array('jquery')); | |
// init all | |
- wp_enqueue_script('tabbed-widgets-init', $this->plugin_path . basename(__FILE__) . '?returnjs=true', array('jquery', 'jquery-ui-tabs', 'jquery-ui-accordion')); | |
+ wp_enqueue_script('tabbed-widgets-init', get_bloginfo('url') . '?tabbedwidgets_returnjs=true', array('jquery', 'jquery-ui-tabs', 'jquery-ui-accordion')); | |
// Add Stylesheet | |
wp_enqueue_style('tabbed-widgets', $this->plugin_path . 'css/tabbed-widgets.css'); | |
} | |
@@ -187,6 +180,7 @@ | |
print $jsvars . "\n"; | |
print $contents; | |
+ die; | |
} | |
} | |
@@ -424,4 +418,4 @@ | |
-?> | |
\ No newline at end of file | |
+?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment