| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Woo Quick View |
| 4 |
Plugin URI: http://ciphercoin.com/ |
| 5 |
Description: Woo Quick View plugin allows the customers to have a brief overview of every product in a light box. |
| 6 |
Author: Arshid |
| 7 |
Author URI: http://ciphercoin.com/ |
| 8 |
Text Domain: woo-quick-view |
| 9 |
Version: 1.1.4 |
| 10 |
*/ |
| 11 |
|
| 12 |
|
| 13 |
register_activation_hook( __FILE__, 'wcqv_quick_view_activate' ); |
| 14 |
function wcqv_quick_view_activate(){ |
| 15 |
|
| 16 |
add_option( 'wpcqv_view_install_date', date('Y-m-d G:i:s'), '', 'yes'); |
| 17 |
|
| 18 |
$data = array( |
| 19 |
'enable_quick_view' => '1', |
| 20 |
'enable_mobile' => '0', |
| 21 |
'button_lable' => 'Quick View' |
| 22 |
); |
| 23 |
add_option( 'wcqv_options', $data, '', 'yes' ); |
| 24 |
|
| 25 |
$data = array( |
| 26 |
'modal_bg' => '#fff', |
| 27 |
'close_btn' => '#95979c', |
| 28 |
'close_btn_bg' => '#4C6298', |
| 29 |
'navigation_bg' => 'rgba(255, 255, 255, 0.2)', |
| 30 |
'navigation_txt' => '#fff' |
| 31 |
|
| 32 |
); |
| 33 |
add_option( 'wcqv_style', $data, '', 'yes' ); |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
register_deactivation_hook( __FILE__, 'wcqv_quick_view_deactivate' ); |
| 38 |
function wcqv_quick_view_deactivate(){ |
| 39 |
|
| 40 |
delete_option( 'wcqv_style' ); |
| 41 |
delete_option( 'wcqv_options' ); |
| 42 |
delete_option( 'wpcqv_view_install_date' ); |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
add_action('plugins_loaded','wqv_load_class_files'); |
| 48 |
|
| 49 |
function wqv_load_class_files(){ |
| 50 |
|
| 51 |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 52 |
|
| 53 |
require_once 'classes/class.frontend.php'; |
| 54 |
require_once 'classes/class.backend.php'; |
| 55 |
|
| 56 |
load_plugin_textdomain( 'woocommerce-quick-view', false, plugin_basename( dirname( __FILE__ ) ) . '/lang' ); |
| 57 |
|
| 58 |
|
| 59 |
$wcqv_plugin_dir_url = plugin_dir_url( __FILE__ ); |
| 60 |
$data = get_option('wcqv_options'); |
| 61 |
$load_backend = new wcqv_backend($wcqv_plugin_dir_url); |
| 62 |
$enable_mobile = ($data['enable_mobile']==='1')?true:false; |
| 63 |
|
| 64 |
|
| 65 |
if ( $load_backend->mobile_detect() ){ |
| 66 |
|
| 67 |
if($enable_mobile && ($data['enable_quick_view'] == 1)){ |
| 68 |
|
| 69 |
$load_frontend = new wcqv_frontend($wcqv_plugin_dir_url); |
| 70 |
} |
| 71 |
|
| 72 |
}else{ |
| 73 |
|
| 74 |
if ( $data['enable_quick_view'] == 1 ){ |
| 75 |
$load_frontend = new wcqv_frontend($wcqv_plugin_dir_url); |
| 76 |
} |
| 77 |
|
| 78 |
} |
| 79 |
|
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
//Add settings link on plugin page |
| 85 |
function wcqv_settings_link($links) { |
| 86 |
$settings_link = '<a href="options-general.php?page=woocommerce-quick-qiew">Settings</a>'; |
| 87 |
array_unshift($links, $settings_link); |
| 88 |
return $links; |
| 89 |
} |
| 90 |
|
| 91 |
$plugin = plugin_basename(__FILE__); |
| 92 |
add_filter("plugin_action_links_$plugin", 'wcqv_settings_link' ); |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|