Changeset 2387544
- Timestamp:
- 09/24/2020 09:04:05 AM (5 years ago)
- Location:
- wn-flipbox-pro/trunk
- Files:
-
- 1 deleted
- 7 edited
-
css/mycss.css (modified) (1 diff)
-
freemius (deleted)
-
js/admin_section.js (modified) (9 diffs)
-
templates/db_handler.php (modified) (1 diff)
-
templates/header.php (modified) (2 diffs)
-
templates/main.php (modified) (2 diffs)
-
templates/wn_ih_admin.php (modified) (2 diffs)
-
wn-flipbox-pro.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wn-flipbox-pro/trunk/css/mycss.css
r2354813 r2387544 4768 4768 4769 4769 #wpbody { 4770 display: none;4771 } 4770 display: block; 4771 } -
wn-flipbox-pro/trunk/js/admin_section.js
r2354813 r2387544 49 49 var aplicar_todos_margin = true; 50 50 51 jQuery("#general_settings_margin_button").toggle(52 function () {53 jQuery("#general_settings_margin_button").css({54 "background-color": "#fdfdfd",55 });56 jQuery("#dahsicon_link_icon").css({ display: "none" });57 jQuery("#dahsicon_brokenlink_icon").css({ display: "block" });58 aplicar_todos_margin = false;59 },60 61 function () {62 jQuery("#general_settings_margin_button").css({63 "background-color": "#838383",64 });65 jQuery("#dahsicon_brokenlink_icon").css({ display: "none" });66 jQuery("#dahsicon_link_icon").css({ display: "block" });67 aplicar_todos_margin = true;68 }69 );70 51 71 52 //Display block a todos los Compu de responsive dashicons … … 395 376 ////////////Font-Family//////////// 396 377 jQuery("#" + reemplaza_aqui + "_dropdown_btn").click(function () { 397 document 398 .getElementById(reemplaza_aqui + "_myDropdown") 399 .classList.toggle("show"); 400 document 401 .getElementById(reemplaza_aqui + "_dropdown_btn") 402 .classList.toggle("active_dropdown_btn"); 403 document 404 .getElementById(reemplaza_aqui + "_fontfamily_droptext") 405 .classList.toggle("active_droptext"); 378 document.getElementById(reemplaza_aqui + "_myDropdown").classList.toggle("show"); 379 document.getElementById(reemplaza_aqui + "_dropdown_btn").classList.toggle("active_dropdown_btn"); 380 document.getElementById(reemplaza_aqui + "_fontfamily_droptext").classList.toggle("active_droptext"); 406 381 }); 407 382 var abajo = true; … … 1661 1636 }; 1662 1637 1663 jQuery("#" + reemplaza_aqui + "_responsive_compu").toggle( 1664 function () { 1638 jQuery("#" + reemplaza_aqui + "_responsive_compu").click(function() { 1639 var clicks = jQuery(this).data('clicks'); 1640 if (!clicks) { 1665 1641 jQuery( 1666 1642 "#" + … … 1670 1646 "_responsive_phone" 1671 1647 ).css({ display: "block" }); 1672 } ,1673 function (){1648 } 1649 else { 1674 1650 jQuery( 1675 1651 "#" + … … 1680 1656 ).css({ display: "none" }); 1681 1657 } 1682 ); 1658 jQuery(this).data("clicks", !clicks); 1659 }); 1660 1661 1683 1662 1684 1663 var responsive_selector = "compu"; … … 2533 2512 } 2534 2513 2535 jQuery("#" + reemplaza_aqui + "_responsive_compu").toggle( 2536 function () { 2537 jQuery( 2538 "#" + 2539 reemplaza_aqui + 2540 "_responsive_ipad, #" + 2541 reemplaza_aqui + 2542 "_responsive_phone" 2543 ).css({ display: "block" }); 2544 }, 2545 function () { 2546 jQuery( 2547 "#" + 2548 reemplaza_aqui + 2549 "_responsive_ipad, #" + 2550 reemplaza_aqui + 2551 "_responsive_phone" 2552 ).css({ display: "none" }); 2553 } 2554 ); 2514 jQuery("#" + reemplaza_aqui + "_responsive_compu").click(function() { 2515 var clicks = jQuery(this).data('clicks'); 2516 if (!clicks) { 2517 jQuery( 2518 "#" + 2519 reemplaza_aqui + 2520 "_responsive_ipad, #" + 2521 reemplaza_aqui + 2522 "_responsive_phone" 2523 ).css({ display: "block" }); 2524 } 2525 else { 2526 jQuery( 2527 "#" + 2528 reemplaza_aqui + 2529 "_responsive_ipad, #" + 2530 reemplaza_aqui + 2531 "_responsive_phone" 2532 ).css({ display: "none" }); 2533 } 2534 jQuery(this).data("clicks", !clicks); 2535 }); 2536 2555 2537 2556 2538 var responsive_selector = "compu"; … … 3202 3184 } 3203 3185 3204 jQuery("#general_settings_" + reemplaza_aqui + "_button").toggle( 3205 function () { 3186 jQuery("#general_settings_" + reemplaza_aqui + "_button").click(function() { 3187 var clicks = jQuery(this).data('clicks'); 3188 if (!clicks) { 3206 3189 jQuery("#general_settings_" + reemplaza_aqui + "_button").css({ 3207 3190 "background-color": "#fdfdfd", … … 3214 3197 }); 3215 3198 aplicar_a_todos = false; 3216 }, 3217 3218 function () { 3199 } 3200 else { 3219 3201 jQuery("#general_settings_" + reemplaza_aqui + "_button").css({ 3220 3202 "background-color": "#838383", … … 3228 3210 aplicar_a_todos = true; 3229 3211 } 3230 ); 3212 jQuery(this).data("clicks", !clicks); 3213 }); 3231 3214 } 3232 3215 -
wn-flipbox-pro/trunk/templates/db_handler.php
r2354813 r2387544 11 11 $return_to = 'main_page'; 12 12 13 $pro = false; 14 if (wfp_fs_wn_flipbox_pro()->is_plan('premium', true)) { 13 if ($general_options['pro'] == true) { 15 14 $pro = true; 16 15 } 16 else { 17 $pro = false; 18 } 19 20 17 21 18 22 function tiene_valor($value) -
wn-flipbox-pro/trunk/templates/header.php
r2354813 r2387544 7 7 */ 8 8 9 $pro = false; 10 if (wfp_fs_wn_flipbox_pro()->is_plan('premium', true)) { 11 $pro = true; 12 } 9 13 10 14 11 ?> … … 187 184 </a> 188 185 189 <a href=" <?php if (!$pro) echo admin_url('admin.php?page=wn_image_hover-pricing'); ?>">186 <a href="https://wirenomads.com/flipbox-image-for-wordpress/"> 190 187 <div class="wn_flipbox_pro_menu_button wn_flipbox_pro_upgrade_button <?php if ($pro) echo esc_attr('wn_flipbox_pro_pro'); ?>"> 191 188 <label><?php if ($pro) echo esc_attr('ACTIVATED'); -
wn-flipbox-pro/trunk/templates/main.php
r2354813 r2387544 19 19 jQuery(document).ready(function($) { 20 20 21 22 23 21 jQuery('#wn_flipbox_pro_header').insertAfter('#screen-meta'); 24 22 jQuery('#wpcontent').css({ … … 40 38 $general_options['returning_from_new'] = false; 41 39 $general_options['flipboxes'] = null; 42 $general_options['pro'] = true;40 $general_options['pro'] = false; 43 41 $general_options['load_google_fonts_selector'] = true; 44 42 $general_options['load_font_awesome_selector'] = true; -
wn-flipbox-pro/trunk/templates/wn_ih_admin.php
r2354813 r2387544 4867 4867 }; 4868 4868 4869 4870 $pro = false; 4871 if (wfp_fs_wn_flipbox_pro()->is_plan('premium', true)) { 4869 if ($general_options['pro'] == true) { 4872 4870 $pro = true; 4873 4871 } 4872 else { 4873 $pro = false; 4874 } 4875 4874 4876 4875 4877 ?> … … 5945 5947 </div> 5946 5948 5947 <div id="shortcode_save_box" name="shortcode_save_box" class="shortcode_save_box" style="display: block;">5949 <div id="shortcode_save_box" name="shortcode_save_box" class="shortcode_save_box" style="display: none;"> 5948 5950 <form action="<?php echo admin_url('admin.php?page=wn_save_handler'); ?>" method="POST"> 5949 5951 <label for="shortcode">Save as Style</label> -
wn-flipbox-pro/trunk/wn-flipbox-pro.php
r2354813 r2387544 34 34 } 35 35 36 if (function_exists('wfp_fs_wn_flipbox_pro')) { 37 wfp_fs_wn_flipbox_pro()->set_basename(false, __FILE__); 38 } else { 39 // DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK. 40 if (!function_exists('wfp_fs_wn_flipbox_pro')) { 41 // ... Freemius integration snippet ... 42 43 if (!function_exists('wfp_fs_wn_flipbox_pro')) { 44 // Create a helper function for easy SDK access. 45 function wfp_fs_wn_flipbox_pro() 46 { 47 global $wfp_fs_wn_flipbox_pro; 48 49 if (!isset($wfp_fs_wn_flipbox_pro)) { 50 // Include Freemius SDK. 51 require_once dirname(__FILE__) . '/freemius/start.php'; 52 $wfp_fs_wn_flipbox_pro = fs_dynamic_init(array( 53 'id' => '6556', 54 'slug' => 'wn-flipbox-pro', 55 'premium_slug' => 'wfp-fs-wn-flipbox-pro-premium', 56 'type' => 'plugin', 57 'public_key' => 'pk_a500f5f2d8b2914d6400fbdb535d6', 58 'is_premium' => false, 59 'has_addons' => false, 60 'has_paid_plans' => true, 61 'menu' => array( 62 'slug' => 'wn_image_hover', 63 'support' => false, 64 ), 65 'is_live' => true, 66 )); 67 } 68 69 return $wfp_fs_wn_flipbox_pro; 36 // ... Your plugin's main file logic ... 37 define('WIRENOMADS_FLIPBOX_DIR', __DIR__); 38 define('WIRENOMADS_FLIPBOX_URL', plugin_dir_url(__FILE__)); 39 define('WIRENOMADS_FLIPBOX_VERSION', '2.1'); 40 41 42 function load_elementor_widget() 43 { 44 require_once WIRENOMADS_FLIPBOX_DIR . '/assets/elementor-widget/my-widgets.php'; 45 } 46 47 class WirenomadsFlipbox 48 { 49 public $my_plugin_name; 50 function __construct() 51 { 52 $this->my_plugin_name = plugin_basename(__FILE__); 53 } 54 55 function register() 56 { 57 add_action('elementor/init', 'load_elementor_widget'); 58 // add_action('init', array($this, 'version_check')); 59 add_action('admin_menu', array($this, 'add_admin_pages')); 60 add_filter("plugin_action_links_{$this->my_plugin_name}", array($this, 'settings_link')); 61 add_action('admin_enqueue_scripts', array($this, 'load_wp_media_files')); 62 add_action('admin_enqueue_scripts', array($this, 'load_my_styles')); 63 add_action('init', array($this, 'zz_shortcode_resource')); 64 add_action('wp_ajax_myprefix_get_image', 'myprefix_get_image'); 65 add_shortcode('wn-flipbox', array($this, 'includeme_call')); 66 } 67 68 function update_version($general_options) 69 { 70 71 72 } 73 74 function version_check() 75 { 76 77 78 } 79 80 function includeme_call($atts = array(), $content = null) 81 { 82 83 if (!is_admin()) { 84 if (!function_exists('elementor_load_plugin_textdomain')) { 85 wp_enqueue_script('jquery'); 86 wp_enqueue_script( 87 "wn_flipbox_pro_outputJs", 88 array('jquery'), 89 '2.1', 90 false 91 ); 70 92 } 71 72 // Init Freemius. 73 wfp_fs_wn_flipbox_pro(); 74 // Signal that SDK was initiated. 75 do_action('wfp_fs_wn_flipbox_pro_loaded'); 76 } 77 } 78 // ... Your plugin's main file logic ... 79 define('WIRENOMADS_FLIPBOX_DIR', __DIR__); 80 define('WIRENOMADS_FLIPBOX_URL', plugin_dir_url(__FILE__)); 81 define('WIRENOMADS_FLIPBOX_VERSION', '2.1'); 82 83 84 function load_elementor_widget() 85 { 86 require_once WIRENOMADS_FLIPBOX_DIR . '/assets/elementor-widget/my-widgets.php'; 87 } 88 89 class WirenomadsFlipbox 90 { 91 public $my_plugin_name; 92 function __construct() 93 { 94 $this->my_plugin_name = plugin_basename(__FILE__); 95 } 96 97 function register() 98 { 99 add_action('elementor/init', 'load_elementor_widget'); 100 add_action('init', array($this, 'version_check')); 101 add_action('admin_menu', array($this, 'add_admin_pages')); 102 add_filter("plugin_action_links_{$this->my_plugin_name}", array($this, 'settings_link')); 103 add_action('admin_enqueue_scripts', array($this, 'load_wp_media_files')); 104 add_action('admin_enqueue_scripts', array($this, 'load_my_styles')); 105 add_action('init', array($this, 'zz_shortcode_resource')); 106 add_action('wp_ajax_myprefix_get_image', 'myprefix_get_image'); 107 add_shortcode('wn-flipbox', array($this, 'includeme_call')); 108 } 109 110 function update_version($general_options) 111 { 112 $general_options['version'] = WIRENOMADS_FLIPBOX_VERSION; 113 update_option('WN_Image_Hover', $general_options); 114 115 } 116 117 function version_check() 118 { 119 120 $general_options = get_option('WN_Image_Hover'); 121 $flipboxes = $general_options['flipboxes']; 122 123 124 if(WIRENOMADS_FLIPBOX_VERSION >= '2.1') 125 { 126 foreach($flipboxes as $new_flipbox) { 127 128 if(!array_key_exists('front_image_overlay_left_value_compu', $new_flipbox)) { 129 $new_flipbox['front_image_overlay_left_value_compu'] = '50%'; 130 $new_flipbox['front_image_overlay_left_value_ipad'] = ''; 131 $new_flipbox['front_image_overlay_left_value_phone'] = ''; 132 $new_flipbox['front_image_overlay_left_type_of_selector'] = '%'; 133 134 $new_flipbox['front_image_overlay_top_value_compu'] = '50%'; 135 $new_flipbox['front_image_overlay_top_value_ipad'] = ''; 136 $new_flipbox['front_image_overlay_top_value_phone'] = ''; 137 $new_flipbox['front_image_overlay_top_type_of_selector'] = '%'; 138 139 $new_flipbox['front_image_overlay_width_value_compu'] = ''; 140 $new_flipbox['front_image_overlay_width_value_ipad'] = ''; 141 $new_flipbox['front_image_overlay_width_value_phone'] = ''; 142 $new_flipbox['front_image_overlay_width_type_of_selector'] = 'px'; 143 144 $new_flipbox['back_image_overlay_left_value_compu'] = '50%'; 145 $new_flipbox['back_image_overlay_left_value_ipad'] = ''; 146 $new_flipbox['back_image_overlay_left_value_phone'] = ''; 147 $new_flipbox['back_image_overlay_left_type_of_selector'] = '%'; 148 149 $new_flipbox['back_image_overlay_top_value_compu'] = '50%'; 150 $new_flipbox['back_image_overlay_top_value_ipad'] = ''; 151 $new_flipbox['back_image_overlay_top_value_phone'] = ''; 152 $new_flipbox['back_image_overlay_top_type_of_selector'] = '%'; 153 154 $new_flipbox['back_image_overlay_width_value_compu'] = ''; 155 $new_flipbox['back_image_overlay_width_value_ipad'] = ''; 156 $new_flipbox['back_image_overlay_width_value_phone'] = ''; 157 $new_flipbox['back_image_overlay_width_type_of_selector'] = 'px'; 158 159 $new_flipbox['front_layer_deep_value'] = '100'; 160 $new_flipbox['front_layer_visible'] = true; 161 $new_flipbox['back_layer_visible'] = true; 162 163 //extra 164 $new_flipbox['general_settings_front_heading_margin_top_compu'] = '0px'; 165 166 $flipboxes[$new_flipbox['shortcode']] = $new_flipbox; 167 $general_options['flipboxes'] = $flipboxes; 168 update_option('WN_Image_Hover', $general_options); 169 } 170 171 } 93 $shortcode = $atts['id']; 94 $file = strip_tags(plugin_dir_path(__FILE__) . 'templates/output.php'); 95 ob_start(); 96 include $file; 97 $buffer = ob_get_clean(); 98 $options = get_option('includeme', array()); 99 if (isset($options['shortcode'])) { 100 $buffer = do_shortcode($buffer); 172 101 } 173 174 175 if ($general_options != '') { 176 177 if (array_key_exists('version', $general_options)) { 178 if ($general_options['version'] < WIRENOMADS_FLIPBOX_VERSION) { 179 $this->update_version($general_options); 180 } 181 } else { 182 $this->update_version($general_options); 183 } 102 return $buffer; 103 } 104 } 105 106 // Ajax action to refresh the user image 107 function myprefix_get_image() 108 { 109 110 if (isset($_GET['id'])) { 111 $image = wp_get_attachment_image( 112 filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT), 113 'medium', 114 false, 115 array( 116 'id' => 'myprefix-preview-image', 117 ) 118 ); 119 $data = array( 120 'image' => $image, 121 ); 122 wp_send_json_success($data); 123 } else { 124 wp_send_json_error(); 125 } 126 } 127 128 function load_my_styles($hook) 129 { 130 131 if ($hook == 'toplevel_page_wn_image_hover' || $hook == 'admin_page_main_page' || $hook == 'wn-flipbox_page_wn_flipbox_settings' || $hook == 'wn-flipbox-pro_page_wn_flipbox_settings') { 132 wp_enqueue_style('dashicons'); 133 wp_enqueue_style('wn_flipbox_pro_css_styles', plugins_url('/css/mycss.css', __FILE__), array(), '2.1'); 134 } 135 } 136 137 function load_wp_media_files($hook) 138 { 139 // Enqueue WordPress media scripts 140 wp_enqueue_media(); 141 // Enqueue custom script that will interact with wp.media 142 wp_enqueue_script( 143 'wn_flipbox_pro_myprefix_script', 144 plugins_url('/js/main.js', __FILE__), 145 array('jquery'), 146 '2.1' 147 ); 148 149 if ($hook == 'admin_page_main_page') { 150 wp_enqueue_script( 151 'wn_flipbox_pro_myprefix_script2', 152 plugins_url('/js/admin_section.js', __FILE__), 153 array('jquery'), 154 '2.1' 155 ); 156 } else { 157 if ($hook == 'wn-flipbox_page_templates_selector' || $hook == 'wn-flipbox-pro_page_templates_selector') { 158 wp_enqueue_script( 159 'wn_flipbox_pro_myprefix_script4', 160 plugins_url('/js/templates_selector.js', __FILE__), 161 array('jquery'), 162 '2.1' 163 ); 184 164 } 185 165 } 186 187 function includeme_call($atts = array(), $content = null) 188 { 189 190 if (!is_admin()) { 191 if (!function_exists('elementor_load_plugin_textdomain')) { 192 wp_enqueue_script('jquery'); 193 wp_enqueue_script( 194 "wn_flipbox_pro_outputJs", 195 array('jquery'), 196 '1.0', 197 false 198 ); 199 } 200 $shortcode = $atts['id']; 201 $file = strip_tags(plugin_dir_path(__FILE__) . 'templates/output.php'); 202 ob_start(); 203 include $file; 204 $buffer = ob_get_clean(); 205 $options = get_option('includeme', array()); 206 if (isset($options['shortcode'])) { 207 $buffer = do_shortcode($buffer); 208 } 209 return $buffer; 210 } 211 } 212 213 // Ajax action to refresh the user image 214 function myprefix_get_image() 215 { 216 217 if (isset($_GET['id'])) { 218 $image = wp_get_attachment_image( 219 filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT), 220 'medium', 221 false, 222 array( 223 'id' => 'myprefix-preview-image', 224 ) 225 ); 226 $data = array( 227 'image' => $image, 228 ); 229 wp_send_json_success($data); 230 } else { 231 wp_send_json_error(); 232 } 233 } 234 235 function load_my_styles($hook) 236 { 237 238 if ($hook == 'toplevel_page_wn_image_hover' || $hook == 'admin_page_main_page' || $hook == 'wn-flipbox_page_wn_flipbox_settings' || $hook == 'wn-flipbox-pro_page_wn_flipbox_settings') { 239 wp_enqueue_style('dashicons'); 240 wp_enqueue_style('wn_flipbox_pro_css_styles', plugins_url('/css/mycss.css', __FILE__)); 241 } 242 } 243 244 function load_wp_media_files($hook) 245 { 246 // Enqueue WordPress media scripts 247 wp_enqueue_media(); 248 // Enqueue custom script that will interact with wp.media 249 wp_enqueue_script( 250 'wn_flipbox_pro_myprefix_script', 251 plugins_url('/js/main.js', __FILE__), 252 array('jquery'), 253 '0.1' 254 ); 255 256 if ($hook == 'admin_page_main_page') { 257 wp_enqueue_script( 258 'wn_flipbox_pro_myprefix_script2', 259 plugins_url('/js/admin_section.js', __FILE__), 260 array('jquery'), 261 '0.1' 262 ); 263 } else { 264 if ($hook == 'wn-flipbox_page_templates_selector' || $hook == 'wn-flipbox-pro_page_templates_selector') { 265 wp_enqueue_script( 266 'wn_flipbox_pro_myprefix_script4', 267 plugins_url('/js/templates_selector.js', __FILE__), 268 array('jquery'), 269 '0.1' 270 ); 271 } 272 } 273 } 274 275 // First register resources with init 276 function zz_shortcode_resource() 277 { 278 wp_register_script( 279 'wn_flipbox_pro_outputJs', 280 plugins_url('/js/templates_selector.js', __FILE__), 281 array('jquery'), 282 "1.0", 283 false 284 ); 285 } 286 287 public function settings_link($links) 288 { 289 $settings_link = '<a href="admin.php?page=wn_image_hover"> Settings</a>'; 290 array_push($links, $settings_link); 291 return $links; 292 } 293 294 public function add_admin_pages() 295 { 296 add_menu_page( 297 'WN Flip Box', 298 'WN Flipbox Pro', 299 'manage_options', 300 'wn_image_hover', 301 array($this, 'admin_index'), 302 WIRENOMADS_FLIPBOX_URL . 'images/wn-flipbox-icon.svg', 303 110 304 ); 305 add_submenu_page( 306 null, 307 'mainpage', 308 "Main Page", 309 'manage_options', 310 'main_page', 311 array($this, 'submenu_index') 312 ); 313 add_submenu_page( 314 'wn_image_hover', 315 'Create New', 316 "Create New", 317 'manage_options', 318 'templates_selector', 319 array($this, 'submenu_templates_selector') 320 ); 321 add_submenu_page( 322 'wn_image_hover', 323 'Settings', 324 "Settings", 325 'manage_options', 326 'wn_flipbox_settings', 327 array($this, 'submenu_settings') 328 ); 329 add_submenu_page( 330 null, 331 'wn_save_handler', 332 "Save Handler", 333 'manage_options', 334 'wn_save_handler', 335 array($this, 'submenu_save_handler') 336 ); 337 } 338 339 public function admin_index() 340 { 341 include_once plugin_dir_path(__FILE__) . '/templates/main.php'; 342 } 343 344 public function submenu_index() 345 { 346 include_once plugin_dir_path(__FILE__) . '/templates/wn_ih_admin.php'; 347 // include_once plugin_dir_path(__FILE__) . '/templates/templates_selector.php'; 348 } 349 350 public function submenu_templates_selector() 351 { 352 // include_once plugin_dir_path(__FILE__) . '/templates/wn_ih_admin.php'; 353 include_once plugin_dir_path(__FILE__) . '/templates/templates_selector.php'; 354 } 355 356 public function submenu_settings() 357 { 358 // include_once plugin_dir_path(__FILE__) . '/templates/wn_ih_admin.php'; 359 include_once plugin_dir_path(__FILE__) . '/templates/settings.php'; 360 } 361 362 public function submenu_save_handler() 363 { 364 // include_once plugin_dir_path(__FILE__) . '/templates/wn_ih_admin.php'; 365 include_once plugin_dir_path(__FILE__) . '/templates/db_handler.php'; 366 } 367 368 function activate() 369 { 370 371 372 } 373 374 function deactivate() 375 { 376 } 377 378 function uninstall() 379 { 380 delete_option('WN_Image_Hover'); 381 } 382 } 383 384 if (class_exists('WirenomadsFlipbox')) { 385 $wirenomadsFlipbox = new WirenomadsFlipbox(); 386 $wirenomadsFlipbox->register(); 387 } 388 389 //activation 390 register_activation_hook(__FILE__, array($wirenomadsFlipbox, 'activate')); 391 //deactivation 392 register_deactivation_hook(__FILE__, array($wirenomadsFlipbox, 'deactivate')); 393 //uninstall 394 // register_unisntall_hook( __FILE__, array($wirenomadsFlipbox, 'uninstall')); 395 } 166 } 167 168 // First register resources with init 169 function zz_shortcode_resource() 170 { 171 wp_register_script( 172 'wn_flipbox_pro_outputJs', 173 plugins_url('/js/templates_selector.js', __FILE__), 174 array('jquery'), 175 "2.1", 176 false 177 ); 178 } 179 180 public function settings_link($links) 181 { 182 $settings_link = '<a href="admin.php?page=wn_image_hover"> Settings</a>'; 183 array_push($links, $settings_link); 184 return $links; 185 } 186 187 public function add_admin_pages() 188 { 189 add_menu_page( 190 'WN Flip Box', 191 'WN Flipbox Pro', 192 'manage_options', 193 'wn_image_hover', 194 array($this, 'admin_index'), 195 WIRENOMADS_FLIPBOX_URL . 'images/wn-flipbox-icon.svg', 196 110 197 ); 198 add_submenu_page( 199 null, 200 'mainpage', 201 "Main Page", 202 'manage_options', 203 'main_page', 204 array($this, 'submenu_index') 205 ); 206 add_submenu_page( 207 'wn_image_hover', 208 'Create New', 209 "Create New", 210 'manage_options', 211 'templates_selector', 212 array($this, 'submenu_templates_selector') 213 ); 214 add_submenu_page( 215 'wn_image_hover', 216 'Settings', 217 "Settings", 218 'manage_options', 219 'wn_flipbox_settings', 220 array($this, 'submenu_settings') 221 ); 222 add_submenu_page( 223 null, 224 'wn_save_handler', 225 "Save Handler", 226 'manage_options', 227 'wn_save_handler', 228 array($this, 'submenu_save_handler') 229 ); 230 } 231 232 public function admin_index() 233 { 234 include_once plugin_dir_path(__FILE__) . '/templates/main.php'; 235 } 236 237 public function submenu_index() 238 { 239 include_once plugin_dir_path(__FILE__) . '/templates/wn_ih_admin.php'; 240 // include_once plugin_dir_path(__FILE__) . '/templates/templates_selector.php'; 241 } 242 243 public function submenu_templates_selector() 244 { 245 // include_once plugin_dir_path(__FILE__) . '/templates/wn_ih_admin.php'; 246 include_once plugin_dir_path(__FILE__) . '/templates/templates_selector.php'; 247 } 248 249 public function submenu_settings() 250 { 251 // include_once plugin_dir_path(__FILE__) . '/templates/wn_ih_admin.php'; 252 include_once plugin_dir_path(__FILE__) . '/templates/settings.php'; 253 } 254 255 public function submenu_save_handler() 256 { 257 // include_once plugin_dir_path(__FILE__) . '/templates/wn_ih_admin.php'; 258 include_once plugin_dir_path(__FILE__) . '/templates/db_handler.php'; 259 } 260 261 function activate() 262 { 263 264 265 } 266 267 function deactivate() 268 { 269 } 270 271 function uninstall() 272 { 273 delete_option('WN_Image_Hover'); 274 } 275 } 276 277 if (class_exists('WirenomadsFlipbox')) { 278 $wirenomadsFlipbox = new WirenomadsFlipbox(); 279 $wirenomadsFlipbox->register(); 280 } 281 282 //activation 283 register_activation_hook(__FILE__, array($wirenomadsFlipbox, 'activate')); 284 //deactivation 285 register_deactivation_hook(__FILE__, array($wirenomadsFlipbox, 'deactivate')); 286 //uninstall 287 // register_unisntall_hook( __FILE__, array($wirenomadsFlipbox, 'uninstall'));
Note: See TracChangeset
for help on using the changeset viewer.