| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Slider Ultimate |
| 4 |
Plugin URI: http://www.EtoileWebDesign.com/plugins/ |
| 5 |
Description: A plugin that lets you create a slider, using posts, WooCommerce or Ultimate Product Catalog products |
| 6 |
Author: Etoile Web Design |
| 7 |
Author URI: http://www.EtoileWebDesign.com/plugins/ |
| 8 |
Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/ |
| 9 |
Text Domain: ultimate-slider |
| 10 |
Version: 1.0.14 |
| 11 |
*/ |
| 12 |
|
| 13 |
global $ewd_us_message; |
| 14 |
global $US_Full_Version; |
| 15 |
global $EWD_US_Version; |
| 16 |
|
| 17 |
$EWD_US_Version = '1.0.3'; |
| 18 |
|
| 19 |
define( 'EWD_US_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 20 |
define( 'EWD_US_CD_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 21 |
|
| 22 |
register_activation_hook(__FILE__,'Set_EWD_US_Options'); |
| 23 |
|
| 24 |
|
| 25 |
if ( is_admin() ){ |
| 26 |
add_action('admin_head', 'EWD_US_Admin_Options'); |
| 27 |
add_action('widgets_init', 'Update_EWD_US_Content'); |
| 28 |
add_action('admin_notices', 'EWD_US_Error_Notices'); |
| 29 |
} |
| 30 |
|
| 31 |
function EWD_US_Admin_Options() { |
| 32 |
wp_enqueue_style( 'ewd-us-admin', plugins_url("ultimate-slider/css/Admin.css")); |
| 33 |
wp_enqueue_style( 'spectrum', plugins_url("ultimate-slider/css/spectrum.css")); |
| 34 |
} |
| 35 |
|
| 36 |
function EWD_US_Enable_Sub_Menu() { |
| 37 |
add_submenu_page('edit.php?post_type=ultimate_slider', 'Slider Options', 'Settings', 'edit_posts', 'us-options', 'EWD_US_Output_Options_Page'); |
| 38 |
} |
| 39 |
add_action('admin_menu' , 'EWD_US_Enable_Sub_Menu'); |
| 40 |
|
| 41 |
|
| 42 |
function EWD_US_Make_Posts_Sortable($hook) { |
| 43 |
global $post; |
| 44 |
if ($hook == 'edit.php' or $hook == 'post-new.php' or $hook == 'post.php' or $hook == 'ultimate_slider_page_us-options' or $hook == 'widgets.php') { |
| 45 |
if ($post->post_type == 'ultimate_slider' or $hook == 'ultimate_slider_page_us-options' or $hook == 'widgets.php') { |
| 46 |
wp_enqueue_script( 'jquery-ui-core' ); |
| 47 |
wp_enqueue_script( 'jquery-ui-sortable' ); |
| 48 |
wp_enqueue_script( 'ultimate-slider-admin', plugins_url('ultimate-slider/js/ultimate-slider-admin.js'), array('jquery', 'jquery-ui-core', 'jquery-ui-sortable'), true); |
| 49 |
wp_enqueue_script( 'spectrum', plugins_url('ultimate-slider/js/spectrum.js'), array('jquery'), true); |
| 50 |
} |
| 51 |
} |
| 52 |
} |
| 53 |
add_action( 'admin_enqueue_scripts', 'EWD_US_Make_Posts_Sortable', 10, 1 ); |
| 54 |
|
| 55 |
add_action( 'wp_enqueue_scripts', 'EWD_US_Add_Stylesheet' ); |
| 56 |
function EWD_US_Add_Stylesheet() { |
| 57 |
wp_enqueue_style( 'ewd-us-main', plugins_url("ultimate-slider/css/ewd-us-main.css")); |
| 58 |
wp_enqueue_style( 'ewd-ulb-main', plugins_url("ultimate-slider/css/ewd-ulb-main.css")); |
| 59 |
} |
| 60 |
|
| 61 |
// Add settings link on plugin page |
| 62 |
function EWD_US_plugin_settings_link($links) { |
| 63 |
$settings_link = '<a href="edit.php?post_type=ultimate_slider">Settings</a>'; |
| 64 |
array_unshift($links, $settings_link); |
| 65 |
return $links; |
| 66 |
} |
| 67 |
$plugin = plugin_basename(__FILE__); |
| 68 |
add_filter("plugin_action_links_$plugin", 'EWD_US_plugin_settings_link' ); |
| 69 |
|
| 70 |
add_action( 'wp_enqueue_scripts', 'Add_EWD_US_FrontEnd_Scripts' ); |
| 71 |
function Add_EWD_US_FrontEnd_Scripts() { |
| 72 |
wp_register_script( 'ultimate-slider', plugins_url('ultimate-slider/js/ultimate-slider.js'), array('jquery'), true); |
| 73 |
|
| 74 |
$Autoplay_Slideshow = get_option('EWD_US_Autoplay_Slideshow'); |
| 75 |
$Autoplay_Delay = get_option('EWD_US_Autoplay_Delay'); |
| 76 |
$Autoplay_Interval = get_option("EWD_US_Autoplay_Interval"); |
| 77 |
$Slide_Transition_Effect = get_option("EWD_US_Slide_Transition_Effect"); |
| 78 |
$Transition_Time = get_option("EWD_US_Transition_Time"); |
| 79 |
$Aspect_Ratio = get_option("EWD_US_Aspect_Ratio"); |
| 80 |
$Mobile_Aspect_Ratio = get_option("EWD_US_Mobile_Aspect_Ratio"); |
| 81 |
$Carousel = get_option("EWD_US_Carousel"); |
| 82 |
$Carousel_Columns = get_option("EWD_US_Carousel_Columns"); |
| 83 |
$Carousel_Link_To_Full = get_option("EWD_US_Carousel_Link_To_Full"); |
| 84 |
$Carousel_Advance = get_option("EWD_US_Carousel_Advance"); |
| 85 |
$Title_Animate = get_option("EWD_US_Title_Animate"); |
| 86 |
$Lightbox = get_option("EWD_US_Lightbox"); |
| 87 |
$Timer_Bar = get_option("EWD_US_Timer_Bar"); |
| 88 |
|
| 89 |
$Aspect_Fraction = EWD_US_Get_Aspect_Fraction($Aspect_Ratio); |
| 90 |
$Mobile_Aspect_Fraction = EWD_US_Get_Aspect_Fraction($Mobile_Aspect_Ratio); |
| 91 |
|
| 92 |
$Data_Array = array( 'autoplay_slideshow' => $Autoplay_Slideshow, |
| 93 |
'autoplay_delay' => $Autoplay_Delay, |
| 94 |
'autoplay_interval' => $Autoplay_Interval, |
| 95 |
'slide_transition_effect' => $Slide_Transition_Effect, |
| 96 |
'transition_time' => $Transition_Time, |
| 97 |
'aspect_ratio' => $Aspect_Fraction, |
| 98 |
'mobile_aspect_ratio' => $Mobile_Aspect_Fraction, |
| 99 |
'slider_carousel' => $Carousel, |
| 100 |
'carousel_columns' => $Carousel_Columns, |
| 101 |
'carousel_link_to_full' => $Carousel_Link_To_Full, |
| 102 |
'carousel_advance' => $Carousel_Advance, |
| 103 |
'title_animate' => $Title_Animate, |
| 104 |
'lightbox' => $Lightbox, |
| 105 |
'timer_bar' => $Timer_Bar |
| 106 |
); |
| 107 |
wp_localize_script( 'ultimate-slider', 'ewd_us_php_data', $Data_Array ); |
| 108 |
|
| 109 |
wp_enqueue_script('ultimate-slider'); |
| 110 |
|
| 111 |
wp_enqueue_script( 'iframe-clicks', plugins_url('ultimate-slider/js/jquery.iframetracker.js'), array('jquery'), true); |
| 112 |
if ($Lightbox == "Yes") { |
| 113 |
wp_enqueue_script( 'ultimate-lightbox', plugins_url('ultimate-slider/js/ultimate-lightbox.js'), array('jquery'), true); |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
function EWD_US_Get_Aspect_Fraction($Aspect_Ratio) { |
| 118 |
if ($Aspect_Ratio == "3_1") {$Aspect_Fraction = .333333333;} |
| 119 |
if ($Aspect_Ratio == "16_7") {$Aspect_Fraction = .444444444;} |
| 120 |
if ($Aspect_Ratio == "2_1") {$Aspect_Fraction = .5;} |
| 121 |
if ($Aspect_Ratio == "16_9") {$Aspect_Fraction = .5625;} |
| 122 |
if ($Aspect_Ratio == "3_2") {$Aspect_Fraction = .666666666;} |
| 123 |
if ($Aspect_Ratio == "4_3") {$Aspect_Fraction = .75;} |
| 124 |
if ($Aspect_Ratio == "1_1") {$Aspect_Fraction = 1;} |
| 125 |
|
| 126 |
return $Aspect_Fraction; |
| 127 |
} |
| 128 |
|
| 129 |
$US_Full_Version = get_option("EWD_US_Full_Version"); |
| 130 |
|
| 131 |
if (isset($_GET['post_type']) and $_GET['post_type'] == 'ultimate_slider' and ($US_Full_Version != "Yes" or get_option("EWD_US_Trial_Happening") == "Yes")) {add_action("admin_notices", "EWD_US_Upgrade_Box");} |
| 132 |
if (isset($_GET['post_type']) and $_GET['post_type'] == 'ultimate_slider' and isset($_POST['EWD_US_Upgrade_To_Full']) and $US_Full_Version == "Yes") {add_action("admin_notices", "EWD_US_Upgrade_Notice");} |
| 133 |
|
| 134 |
if (isset($_POST['EWD_US_Upgrade_To_Full'])) { |
| 135 |
add_action('admin_init', 'EWD_US_Upgrade_To_Full'); |
| 136 |
} |
| 137 |
|
| 138 |
$Show_TinyMCE = get_option("EWD_US_Show_TinyMCE"); |
| 139 |
if ($Show_TinyMCE == "Yes") { |
| 140 |
add_filter( 'mce_buttons', 'EWD_US_Register_TinyMCE_Buttons' ); |
| 141 |
add_filter( 'mce_external_plugins', 'EWD_US_Register_TinyMCE_Javascript' ); |
| 142 |
add_action('admin_head', 'EWD_US_Output_TinyMCE_Vars'); |
| 143 |
} |
| 144 |
|
| 145 |
function EWD_US_Register_TinyMCE_Buttons( $buttons ) { |
| 146 |
array_push( $buttons, 'separator', 'US_Shortcodes' ); |
| 147 |
return $buttons; |
| 148 |
} |
| 149 |
|
| 150 |
function EWD_US_Register_TinyMCE_Javascript( $plugin_array ) { |
| 151 |
$plugin_array['US_Shortcodes'] = plugins_url( '/js/tinymce-plugin.js',__FILE__ ); |
| 152 |
|
| 153 |
return $plugin_array; |
| 154 |
} |
| 155 |
|
| 156 |
function EWD_US_Output_TinyMCE_Vars() { |
| 157 |
global $US_Full_Version; |
| 158 |
|
| 159 |
$Categories = get_terms('ultimate_slider_categories', array('hide_empty' => false)); |
| 160 |
if ($Categories) { |
| 161 |
foreach ($Categories as $Category) { |
| 162 |
$Category_Array_Item['Category_Name'] = $Category->name; |
| 163 |
$Category_Array_Item['Category_Slug'] = $Category->slug; |
| 164 |
|
| 165 |
$Categories_Array[] = $Category_Array_Item; |
| 166 |
} |
| 167 |
} |
| 168 |
$WC_Categories = get_terms('product_cat', array('hide_empty' => false)); |
| 169 |
if ($WC_Categories) { |
| 170 |
foreach ($WC_Categories as $Category) { |
| 171 |
$Category_Array_Item['Category_Name'] = $Category->name; |
| 172 |
$Category_Array_Item['Category_Slug'] = $Category->slug; |
| 173 |
|
| 174 |
$WC_Categories_Array[] = $Category_Array_Item; |
| 175 |
} |
| 176 |
} |
| 177 |
|
| 178 |
echo "<script type='text/javascript'>"; |
| 179 |
echo "var us_premium = '" . $US_Full_Version . "';\n"; |
| 180 |
echo "var slider_categories = " . json_encode($Categories_Array) . ";\n"; |
| 181 |
echo "var woocommerce_categories = " . json_encode($WC_Categories_Array) . ";\n"; |
| 182 |
echo "</script>"; |
| 183 |
} |
| 184 |
|
| 185 |
|
| 186 |
include "Functions/EWD_US_Add_Meta_Boxes.php"; |
| 187 |
include "Functions/EWD_US_Add_Order_Column.php"; |
| 188 |
include "Functions/EWD_US_Error_Notices.php"; |
| 189 |
include "Functions/EWD_US_Full_Upgrade.php"; |
| 190 |
include "Functions/EWD_US_Output_Options_Page.php"; |
| 191 |
include "Functions/EWD_US_Process_Ajax.php"; |
| 192 |
include "Functions/EWD_US_Register_Custom_Posttype.php"; |
| 193 |
include "Functions/EWD_US_Upgrade_Box.php"; |
| 194 |
include "Functions/EWD_US_Version_Reversion.php"; |
| 195 |
include "Functions/EWD_US_Widgets.php"; |
| 196 |
include "Functions/EWD_US_WooCommerce.php"; |
| 197 |
include "Functions/Update_EWD_US_Admin_Databases.php"; |
| 198 |
include "Functions/Update_EWD_US_Content.php"; |
| 199 |
include "Functions/EWD_US_Styling.php"; |
| 200 |
include "Functions/EWD_US_Add_Views_Column.php"; |
| 201 |
|
| 202 |
include "Shortcodes/Display_Slider.php"; |
| 203 |
|
| 204 |
if (get_option('EWD_US_Version') != $EWD_US_Version) { |
| 205 |
Set_EWD_US_Options(); |
| 206 |
} |
| 207 |
|
| 208 |
function Set_EWD_US_Options() { |
| 209 |
global $US_Full_Version; |
| 210 |
global $EWD_US_Version; |
| 211 |
|
| 212 |
if (get_option("EWD_US_Autoplay_Slideshow") == "") {update_option("EWD_US_Autoplay_Slideshow", "Yes");} |
| 213 |
if (get_option("EWD_US_Autoplay_Delay") == "") {update_option("EWD_US_Autoplay_Delay", 6);} |
| 214 |
if (get_option("EWD_US_Autoplay_Interval") == "") {update_option("EWD_US_Autoplay_Interval", 4);} |
| 215 |
if (get_option("EWD_US_Transition_Time") == "") {update_option("EWD_US_Transition_Time", 1);} |
| 216 |
if (get_option("EWD_US_Aspect_Ratio") == "") {update_option("EWD_US_Aspect_Ratio", "16_7");} |
| 217 |
if (get_option("EWD_US_Carousel") == "") {update_option("EWD_US_Carousel", "No");} |
| 218 |
if (get_option("EWD_US_Carousel_Columns") == "") {update_option("EWD_US_Carousel_Columns", "3");} |
| 219 |
if (get_option("EWD_US_Carousel_Link_To_Full") == "") {update_option("EWD_US_Carousel_Link_To_Full", "Yes");} |
| 220 |
if (get_option("EWD_US_Carousel_Advance") == "") {update_option("EWD_US_Carousel_Advance", "Full");} |
| 221 |
if (get_option("EWD_US_Show_TinyMCE") == "") {update_option("EWD_US_Show_TinyMCE", "Yes");} |
| 222 |
if (get_option("EWD_US_Timer_Bar") == "") {update_option("EWD_US_Timer_Bar", "Top");} |
| 223 |
if (get_option("EWD_US_Slide_Indicators") == "") {update_option("EWD_US_Slide_Indicators", "Dots");} |
| 224 |
if (get_option("EWD_US_Link_Action") == "") {update_option("EWD_US_Link_Action", "Same");} |
| 225 |
if (get_option("EWD_US_Slide_Transition_Effect") == "") {update_option("EWD_US_Slide_Transition_Effect", "slide");} |
| 226 |
if (get_option("EWD_US_WC_Product_Image_Slider") == "") {update_option("EWD_US_WC_Product_Image_Slider", "No");} |
| 227 |
if (get_option("EWD_US_Mobile_Aspect_Ratio") == "") {update_option("EWD_US_Mobile_Aspect_Ratio", get_option("EWD_US_Aspect_Ratio"));} |
| 228 |
if (get_option("EWD_US_Hide_On_Mobile") == "") {update_option("EWD_US_Hide_On_Mobile", array('body', 'buttons'));} |
| 229 |
if (get_option("EWD_US_Mobile_Link_To_Full") == "") {update_option("EWD_US_Mobile_Link_To_Full", "No");} |
| 230 |
if (get_option("EWD_US_Add_Watermark") == "") {update_option("EWD_US_Add_Watermark", "No");} |
| 231 |
if (get_option("EWD_US_Title_Animate") == "") {update_option("EWD_US_Title_Animate", "None");} |
| 232 |
if (get_option("EWD_US_Lightbox") == "") {update_option("EWD_US_Lightbox", "No");} |
| 233 |
if (get_option("EWD_US_Full_Version") == "") {update_option("EWD_US_Full_Version", "No");} |
| 234 |
|
| 235 |
if (get_option("EWD_us_Arrow") == "") {update_option("EWD_us_Arrow", "a");} |
| 236 |
if (get_option("EWD_us_Arrow_Background_Shape") == "") {update_option("EWD_us_Arrow_Background_Shape", "None");} |
| 237 |
if (get_option("EWD_us_Arrow_Line_Height") == "") {update_option("EWD_us_Arrow_Line_Height", "1.25");} |
| 238 |
|
| 239 |
update_option("EWD_US_Version", $EWD_US_Version); |
| 240 |
} |
| 241 |
|