public
Last active

tabbed widgets fix

  • Download Gist
tabbed-widgets.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
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
+?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.