Skip to content

Instantly share code, notes, and snippets.

@deltafactory
Created August 19, 2013 20:36
Show Gist options
  • Save deltafactory/6273833 to your computer and use it in GitHub Desktop.
Save deltafactory/6273833 to your computer and use it in GitHub Desktop.
Patch file for http://wordpress.org/plugins/dk-new-medias-image-rotator-widget/dk-image-rotator-widget.php. It fixes mixed content warnings in browsers like Firefox. Some minor redundant or non-performant calls have also been removed.
Index: dk-image-rotator-widget.php
===================================================================
--- dk-image-rotator-widget.php (revision 758674)
+++ dk-image-rotator-widget.php (working copy)
@@ -40,16 +40,13 @@
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
}
-
+
wp_enqueue_script('jquery-ui-sortable');
- wp_register_script('irw-js', path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) ).'/js/main.js'), array('jquery','media-upload','thickbox'));
- wp_enqueue_script('irw-js');
- wp_register_script('irw-qtip', path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) ).'/js/jquery.qtip.js'), array('jquery','media-upload','thickbox'));
- wp_enqueue_script('irw-qtip');
+ wp_enqueue_script('irw-js', plugins_url( '', __FILE__ ) . '/js/main.js', array('jquery','media-upload','thickbox'));
+ wp_enqueue_script('irw-qtip', plugins_url( '', __FILE__ ) . '/js/jquery.qtip.js', array('jquery','media-upload','thickbox'));
// Styles
- wp_register_style('irw-css', path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) ).'/css/main.css'));
- wp_enqueue_style('irw-css');
+ wp_enqueue_style('irw-css', plugins_url( '', __FILE__ ) .'/css/main.css' );
}
/**
@@ -58,23 +55,23 @@
function irw_widget_actions() {
// Scripts
- wp_enqueue_script('jquery');
- wp_register_script('jquery-imagesloaded', path_join(WP_PLUGIN_URL, basename(dirname(__FILE__)).'/js/jquery.imagesloaded.js'));
- wp_enqueue_script('jquery-imagesloaded');
- wp_register_script('irw-widget', path_join(WP_PLUGIN_URL, basename(dirname(__FILE__)).'/js/dk-image-rotator-widget.js'));
- wp_enqueue_script('irw-widget');
+ wp_enqueue_style('jquery-imagesloaded', plugins_url( '', __FILE__ ) .'/js/jquery.imagesloaded.js', array( 'jquery' ) );
+ wp_enqueue_style('irw-widget', plugins_url( '', __FILE__ ) . '/js/dk-image-rotator-widget.js');
// Styles
- wp_register_style('irw-widget', path_join(WP_PLUGIN_URL, basename(dirname(__FILE__)).'/css/dk-image-rotator-widget.css'));
- wp_enqueue_style('irw-widget');
+ wp_enqueue_style('irw-widget', plugins_url( '', __FILE__ ) . '/css/dk-image-rotator-widget.css');
}
+ function irw_widget_init() {
+ register_widget("DK_Image_Rotator_Widget");
+ }
+
/**
* Hooks & schizzz
*/
add_action('admin_enqueue_scripts', 'irw_admin_actions');
add_action('wp_enqueue_scripts', 'irw_widget_actions');
- add_action('widgets_init', create_function('', 'register_widget("DK_Image_Rotator_Widget");'));
+ add_action('widgets_init', 'irw_widget_init' );
/**
* DK_Image-Rotator-Widget Class
@@ -143,7 +140,15 @@
function form($instance) {
- $defaults = array( 'irw_images' => '', 'irw_nofollow' => 'false', 'irw_new_window' => 'false' );
+ $defaults = array(
+ 'irw_title' => '',
+ 'irw_images' => '',
+ 'irw_transition' => 'linear',
+ 'irw_transition_speed' => 1,
+ 'irw_nofollow' => 'false',
+ 'irw_new_window' => 'false'
+ );
+
$instance = wp_parse_args((array) $instance, $defaults);
if ($instance) {
@mxmader
Copy link

mxmader commented Oct 2, 2013

thanks! this helped me fix an identical bug with User Access Manager plugin as well as Final Tiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment