PluginProbe
Hunk Companion / trunk
Hunk Companion vtrunk
2.0.8 2.0.7 2.0.6 2.0.5 2.0.3 2.0.4 trunk 1.2.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.14 1.6.2 1.6.3 All 65 releases
hunk-companion / hunk-companion.php

hunk-companion.php in Hunk Companion trunk, at hunk-companion.php

266 lines 15.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Hunk Companion
4 Plugin URI: https://themehunk.com/hunk-companion/
5 Description: Hunk companion plugin is an essential plugin to add features of Front page sections in your site. An easy to use plugin with ThemeHunk WordPress themes.
6 Version: 2.0.8
7 Author: ThemeHunk
8 License: GNU General Public License v3 or later
9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10 Text Domain: hunk-companion
11 Author URI: https://themehunk.com/
12 */
13
14 if (!defined('ABSPATH')) exit;
15 // Version constant for easy CSS refreshes
16 define('HUNK_COMPANION', '2.0.8');
17 define('HUNK_COMPANION_EXT_FILE', __FILE__ );
18 define('HUNK_COMPANION_PLUGIN_DIR_URL', plugin_dir_url(HUNK_COMPANION_EXT_FILE));
19 define('HUNK_COMPANION_BASENAME', plugin_basename(HUNK_COMPANION_EXT_FILE));
20 define('HUNK_COMPANION_DIR_PATH', plugin_dir_path(HUNK_COMPANION_EXT_FILE));
21 require_once(ABSPATH . 'wp-admin/includes/plugin.php');
22 include_once(plugin_dir_path(__FILE__) . 'notify/notify.php');
23 function hunk_companion_text_domain()
24 {
25 $theme = wp_get_theme();
26 $themeArr = array();
27 $themeArr[] = $theme->get('TextDomain');
28 $themeArr[] = $theme->get('Template');
29 return $themeArr;
30 }
31
32 function hunk_companion_gogolite_body_classes($classes){
33 $classes[] = 'gogolite';
34 return $classes;
35 }
36
37 function hunk_companion_load_plugin(){
38
39 $theme = hunk_companion_text_domain();
40 if(in_array("almaira-shop", $theme)){
41 require_once( HUNK_COMPANION_DIR_PATH . '/import/import.php' );
42 require_once HUNK_COMPANION_DIR_PATH .'almaira-shop/almaira-shop-admin/init.php';
43 require_once HUNK_COMPANION_DIR_PATH .'almaira-shop/demo/import-data.php';
44 add_action( 'wp_enqueue_scripts', 'hunk_companion_almaira_shop_scripts' );
45
46 }
47 elseif(in_array("gogo", $theme)){
48 require_once( HUNK_COMPANION_DIR_PATH . '/import/import.php' );
49 require_once HUNK_COMPANION_DIR_PATH . 'gogolite/admin/gogo-function.php';
50 require_once HUNK_COMPANION_DIR_PATH . 'gogolite/admin/init.php';
51 add_filter('body_class', 'hunk_companion_gogolite_body_classes');
52 add_action( 'wp_enqueue_scripts', 'hunk_companion_gogolite_scripts' );
53 }
54 elseif(in_array("open-shop", $theme)){
55 require_once( HUNK_COMPANION_DIR_PATH . '/import/import.php' );
56 require_once HUNK_COMPANION_DIR_PATH . 'open-shop/open-shop-admin/init.php';
57 require_once HUNK_COMPANION_DIR_PATH .'open-shop/demo/import-data.php';
58 add_action( 'wp_enqueue_scripts', 'hunk_companion_open_shop_scripts' );
59 }
60 elseif(in_array("top-store", $theme)){
61 require_once( HUNK_COMPANION_DIR_PATH . '/import/import.php' );
62 require_once HUNK_COMPANION_DIR_PATH . 'top-store/top-store-admin/init.php';
63 require_once HUNK_COMPANION_DIR_PATH .'top-store/demo/import-data.php';
64 add_action( 'wp_enqueue_scripts', 'hunk_companion_top_store_scripts' );
65 }
66 elseif(in_array("portfoliolite", $theme)){
67 require_once( HUNK_COMPANION_DIR_PATH . '/import/import.php' );
68 require_once HUNK_COMPANION_DIR_PATH . 'portfoliolite/admin/init.php';
69 add_action( 'wp_enqueue_scripts', 'hunk_companion_portfoliolite_scripts' );
70 add_action('customize_controls_enqueue_scripts', 'hunk_companion_portfoliolite_customizer_scripts' );
71 }
72 elseif(in_array("open-mart", $theme) && !function_exists( 'open_mart_load_plugin' )){
73 require_once( HUNK_COMPANION_DIR_PATH . '/import/import.php' );
74 require_once HUNK_COMPANION_DIR_PATH . 'open-mart/open-mart-admin/init.php';
75 require_once HUNK_COMPANION_DIR_PATH .'open-mart/demo/import-data.php';
76 add_action( 'wp_enqueue_scripts', 'hunk_companion_open_mart_scripts' );
77 }
78 elseif(in_array("th-shop-mania", $theme)){
79 if ( !function_exists('th_shop_mania_pro_load_plugin' ) && !function_exists('mania_companion_load_plugin' ) ) {
80 require_once( HUNK_COMPANION_DIR_PATH . '/import/import.php' );
81 require_once HUNK_COMPANION_DIR_PATH . 'th-shop-mania/init.php';
82 add_action('admin_enqueue_scripts', 'hunk_companion_thsm_admin_scripts');
83 }
84
85 }
86 }
87 add_action('after_setup_theme', 'hunk_companion_load_plugin');
88 function hunk_companion_gogolite_scripts()
89 {
90 //Gogo frontpage styles
91 wp_enqueue_style('gogo_section_css', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/css/gogo-css/section.css', array(), '1.0.0');
92 wp_enqueue_style('animate', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/css/gogo-css/animate.css', array(), '1.0.0');
93 //Gogo frontpage scripts
94 wp_enqueue_script('owl.carousel', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/owl.carousel.js', array('jquery'), '', true);
95 wp_enqueue_script('typer', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/typer.js', array('jquery'), '1.0.0', true);
96 wp_enqueue_script('isotope.pkgd', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/isotope.pkgd.js', array('jquery'), '', false);
97 wp_enqueue_script('vertical-navigation-modernizr', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/vertical-navigation-modernizr.js', array('jquery'), '', false);
98 wp_enqueue_script('vertical-navigation-main', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/vertical-navigation-main.js', array('jquery'), '', false);
99 wp_enqueue_script('wow', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/wow.min.js', array('jquery'), '', false);
100 wp_enqueue_script('masonry', array('imagesloaded'));
101 wp_enqueue_script('gogo-frontpage-custom-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/custom.js', array('jquery'), '', false);
102 wp_localize_script('gogo-frontpage-custom-js', 'frontendajax', array('ajaxurl' => admin_url('admin-ajax.php')));
103 }
104 function hunk_companion_almaira_shop_scripts()
105 {
106 wp_enqueue_style('owl.carousel-css', HUNK_COMPANION_PLUGIN_DIR_URL . 'almaira-shop/assets/css/owl.carousel.css', array(), '1.0.0');
107 wp_enqueue_style('swiper-css', HUNK_COMPANION_PLUGIN_DIR_URL . 'almaira-shop/assets/css/swiper.css', array(), '1.0.0');
108 wp_enqueue_script('owl.carousel-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/owl.carousel.js', array('jquery'), '', false);
109 wp_enqueue_script('swiper-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'almaira-shop/assets/js/swiper.js', array('jquery'), '', false);
110 wp_enqueue_script('isotope.pkgd', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/isotope.pkgd.js', array('jquery'), '', false);
111 wp_enqueue_script('almaira-custom-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'almaira-shop/assets/js/almaira-custom.js', array('jquery'), '', false);
112 }
113
114 function hunk_companion_open_shop_scripts()
115 {
116 wp_enqueue_style('owl.carousel-css', HUNK_COMPANION_PLUGIN_DIR_URL . 'almaira-shop/assets/css/owl.carousel.css', array(), '1.0.0');
117 wp_enqueue_script('owl.carousel-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/owl.carousel.js', array('jquery'), '', false);
118 wp_enqueue_script('jssor.slider-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'open-shop/assets/js/jssor.slider.min.js', array('jquery'), '', false);
119 wp_enqueue_script('thunk-open-shop-custom-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'open-shop/assets/js/custom.js', array('jquery'), '', true);
120 wp_enqueue_script('thunk-open-shop-woo-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'open-shop/open-shop-admin/woo/js/woocommerce.js', array('jquery'), '1.0.0', true);
121 $openshoplocalize = array(
122 'open_shop_top_slider_optn' => get_theme_mod('open_shop_top_slider_optn', false),
123 'open_shop_top_slider_speed' => get_theme_mod('open_shop_top_slider_speed', 1000),
124 'open_shop_move_to_top_optn' => get_theme_mod('open_shop_move_to_top', false),
125 );
126 wp_localize_script('thunk-open-shop-custom-js', 'open_shop', $openshoplocalize);
127 $localize = array(
128 'ajaxUrl' => admin_url('admin-ajax.php'),
129 //cat-tab-filter
130 'open_shop_single_row_slide_cat' => get_theme_mod('open_shop_single_row_slide_cat', false),
131 //product-slider
132 'open_shop_single_row_prdct_slide' => get_theme_mod('open_shop_single_row_prdct_slide', false),
133 //product-list
134 'open_shop_single_row_prdct_list' => get_theme_mod('open_shop_single_row_prdct_list', false),
135 //cat-tab-list-filter
136 'open_shop_single_row_slide_cat_tb_lst' => get_theme_mod('open_shop_single_row_slide_cat_tb_lst', false),
137 //rtl
138 'open_shop_rtl' => get_theme_mod('open_shop_rtl', false),
139 'opnonce' => wp_create_nonce( 'openshop_nonce' ),
140
141 );
142
143 wp_localize_script('thunk-open-shop-woo-js', 'openshop', $localize);
144 }
145
146 function hunk_companion_top_store_scripts()
147 {
148 wp_enqueue_style('owl.carousel-css', HUNK_COMPANION_PLUGIN_DIR_URL . 'almaira-shop/assets/css/owl.carousel.css', array(), '1.0.0');
149 wp_enqueue_script('owl.carousel-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/owl.carousel.js', array('jquery'), '', false);
150 wp_enqueue_script('jssor.slider-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'open-shop/assets/js/jssor.slider.min.js', array('jquery'), '', false);
151 wp_enqueue_script('thunk-top-store-custom-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'top-store/assets/js/custom.js', array('jquery'), '', true);
152 wp_enqueue_script('thunk-top-store-woo-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'top-store/top-store-admin/woo/js/woocommerce.js', array('jquery'), '', true);
153 $openshoplocalize = array(
154 'top_store_top_slider_optn' => get_theme_mod('top_store_top_slider_optn', false),
155 'top_store_move_to_top_optn' => get_theme_mod('top_store_move_to_top', false),
156 'top_store_top_slider_speed' => get_theme_mod('top_store_top_slider_speed', 1000),
157 'top_store_sidebar_front_option' => get_theme_mod('top_store_sidebar_front_option', 'active-sidebar'),
158 );
159 wp_localize_script('thunk-top-store-custom-js', 'top_store', $openshoplocalize);
160 $localize = array(
161 'ajaxUrl' => admin_url('admin-ajax.php'),
162 //cat-tab-filter
163 'top_store_single_row_slide_cat' => get_theme_mod('top_store_single_row_slide_cat', false),
164 //product-slider
165 'top_store_single_row_prdct_slide' => get_theme_mod('top_store_single_row_prdct_slide', false),
166 //product-list
167 'top_store_single_row_prdct_list' => get_theme_mod('top_store_single_row_prdct_list', false),
168
169 //cat-tab-list-filter
170 'top_store_single_row_slide_cat_tb_lst' => get_theme_mod('top_store_single_row_slide_cat_tb_lst', false),
171
172 'top_store_cat_slider_optn' => get_theme_mod('top_store_cat_slider_optn', false),
173 'top_store_product_slider_optn' => get_theme_mod('top_store_product_slider_optn', false),
174 'top_store_category_slider_optn' => get_theme_mod('top_store_category_slider_optn', false),
175 'top_store_product_list_slide_optn' => get_theme_mod('top_store_product_list_slide_optn', false),
176 'top_store_brand_slider_optn' => get_theme_mod('top_store_brand_slider_optn', false),
177 'nonce' => wp_create_nonce( 'topstore_nonce' ),
178
179 );
180
181 wp_localize_script('thunk-top-store-woo-js', 'topstore', $localize);
182 }
183
184 function hunk_companion_portfoliolite_scripts()
185 {
186 wp_enqueue_style('animate', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/css/animate.css', array(), '1.0.0');
187 wp_enqueue_style('portfoliolite-owl.carousel', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/css/owl.carousel.css', array(), '1.0.0');
188 wp_add_inline_style('portfoliolite-style', portfoliolite_plug_custom_style());
189
190 wp_enqueue_script('masonry', array('imagesloaded'));
191 wp_enqueue_script('portfoliolite-wow', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/wow.js', array('jquery'), '', true);
192
193 wp_enqueue_script('portfoliolite-isotope', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/isotope.pkgd.min.js', array('jquery'), '', true);
194 wp_enqueue_script('portfoliolite-bxslider', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/jquery.bxslider.min.js', array('jquery'), '', true);
195 wp_enqueue_script('portfoliolite-flexslider', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/jquery.flexslider.js', array('jquery'), '', true);
196 wp_enqueue_script('portfoliolite-typer', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/jquery.typer.js', array('jquery'), '', true);
197 wp_enqueue_script('portfoliolite-modernizr', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/modernizr-2.6.2.min.js', array('jquery'), '', true);
198
199 wp_enqueue_script('portfoliolite-owl.carousel', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/owl.carousel.js', array('jquery'), '', true);
200 wp_enqueue_script('portfoliolite-skrollr', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/skrollr.js', array('jquery'), '', true);
201 wp_enqueue_script('portfoliolite-wow', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/wow.js', array('jquery'), '', true);
202
203 wp_enqueue_script('portfoliolite-custom-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/custom.js', array('jquery'), '1.0.0', true);
204 wp_localize_script('portfoliolite-custom-js', 'frontendajax', array(
205 'ajaxurl' => admin_url('admin-ajax.php'),
206 'portnonce' => wp_create_nonce( 'portfoliolite_nonce' ),
207 ));
208 }
209
210 function hunk_companion_portfoliolite_customizer_scripts()
211 {
212 wp_enqueue_script('portfoliolite-widget', HUNK_COMPANION_PLUGIN_DIR_URL . 'portfoliolite/assets/js/widget.js', array('jquery'), '', true);
213 }
214
215 function hunk_companion_open_mart_scripts()
216 {
217 wp_enqueue_style('owl.carousel-css', HUNK_COMPANION_PLUGIN_DIR_URL . 'almaira-shop/assets/css/owl.carousel.css', array(), '1.0.0');
218 wp_add_inline_style('open-mart-style', open_mart_th_custom_style());
219 wp_enqueue_script('owl.carousel-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'gogolite/js/gogo-js/owl.carousel.js', array('jquery'), '', false);
220 wp_enqueue_script('jssor.slider-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'open-shop/assets/js/jssor.slider.min.js', array('jquery'), '', false);
221 wp_enqueue_script('thunk-open-mart-sticky-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'open-mart/assets/js/sticky-sidebar.js', array('jquery'), '', true);
222 wp_enqueue_script('thunk-open-mart-custom-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'open-mart/assets/js/custom.js', array('jquery'), '', true);
223 wp_enqueue_script('thunk-open-mart-woo-js', HUNK_COMPANION_PLUGIN_DIR_URL . 'open-mart/open-mart-admin/woo/js/woocommerce.js', array('jquery'), '1.0.0', true);
224 $openmartlocalize = array(
225 'open_mart_top_slider_optn' => get_theme_mod('open_mart_top_slider_optn', false),
226 'open_mart_move_to_top_optn' => get_theme_mod('open_mart_move_to_top', false),
227 'open_mart_pro_sticky_header_effect' => get_theme_mod('open_mart_pro_sticky_header_effect', 'scrltop'),
228 'open_mart_slider_speed' => get_theme_mod('open_mart_slider_speed', '3000'),
229 //End-to-End
230 'open_mart_page_lyout_endtoend' => get_theme_mod('open_mart_page_lyout_endtoend', false),
231 );
232 wp_localize_script('thunk-open-mart-custom-js', 'open_mart_obj', $openmartlocalize);
233 $localize = array(
234 'ajaxUrl' => admin_url('admin-ajax.php'),
235 //cat-tab-filter
236 'open_mart_cat_adimg' => get_theme_mod('open_mart_cat_adimg', ''),
237 'open_mart_cat_slider_optn' => get_theme_mod('open_mart_cat_slider_optn', false),
238
239 //cat-slider
240 'open_mart_category_slider_optn' => get_theme_mod('open_mart_category_slider_optn', false),
241 'open_mart_cat_slider_heading' => get_theme_mod('open_mart_cat_slider_heading', 'Category Slider'),
242 //product-list
243 'open_mart_single_row_prdct_list' => get_theme_mod('open_mart_single_row_prdct_list', false),
244 'open_mart_product_list_slide_optn' => get_theme_mod('open_mart_product_list_slide_optn', false),
245 'open_mart_pl_image' => get_theme_mod('open_mart_pl_image', ''),
246
247
248 //vert-tab-filter
249 'open_mart_single_row_slide_cat_vt' => get_theme_mod('open_mart_single_row_slide_cat_vt', false),
250 'open_mart_vt_cat_slider_optn' => get_theme_mod('open_mart_vt_cat_slider_optn', false),
251 'open_mart_vt_banner_atply' => get_theme_mod('open_mart_vt_banner_atply', false),
252 //category-filter
253 'open_mart_cat_item_no' => get_theme_mod('open_mart_cat_item_no', 10),
254 'opmrtnonce' => wp_create_nonce( 'openmart_nonce' ),
255 );
256
257 wp_localize_script('thunk-open-mart-woo-js', 'openmart', $localize);
258 }
259
260 function hunk_companion_thsm_admin_scripts(){
261 wp_localize_script('th-shop-mania-admin-load', 'hunk_companion_import',
262 array(
263 'plugin' => 'hunk-companion'
264 )
265 );
266 }