PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.0.2
Shortcodes and extra features for Phlox theme v1.0.2
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / general-hooks.php
auxin-elements / includes Last commit date
classes 9 years ago elements 9 years ago define.php 9 years ago general-functions.php 9 years ago general-hooks.php 9 years ago general-shortcodes.php 9 years ago index.php 9 years ago
general-hooks.php
930 lines
1 <?php
2 /**
3 * Before Single Products Summary Div
4 *
5 *
6 * @package auxin-elements
7 * @license LICENSE.txt
8 * @author
9 * @link https://bitbucket.org/averta/
10 * @copyright (c) 2010-2016
11 */
12
13
14
15 /**
16 * Adds a mian css class indicator to body tag
17 *
18 * @param array $classes List of body css classes
19 * @return array The modified list of body css classes
20 */
21 function auxels_body_class( $classes ) {
22 $classes[] = '_auxels';
23
24 return $classes;
25 }
26 add_filter( 'body_class', 'auxels_body_class' );
27
28
29
30 /**
31 * Add meta custom field types for vc
32 *
33 * @return void
34 */
35 function auxin_add_vc_field_types(){
36
37 if ( defined( 'WPB_VC_VERSION' ) ) {
38
39 vc_add_shortcode_param( 'aux_visual_select', 'auxin_aux_visual_select_settings_field', ADMIN_JS_URL . 'scripts.js' );
40 function auxin_aux_visual_select_settings_field( $settings, $value ) {
41
42 $output = '<select class="meta-select visual-select-wrapper" >';
43 foreach ( $settings['choices'] as $id => $option_info ) {
44 $active_attr = ( $id == $settings['std'] ) ? 'selected' : '';
45 $data_class = isset( $option_info['css_class'] ) && ! empty( $option_info['css_class'] ) ? 'data-class="'. $option_info['css_class'].'"' : '';
46 $data_symbol = empty( $data_class ) && isset( $option_info['image'] ) && ! empty( $option_info['image'] ) ? 'data-symbol="'. $option_info['image'].'"' : '';
47 $output .= sprintf( '<option value="%s" %s %s %s>%s</option>', $id, $active_attr, $data_symbol, $data_class, $option_info['label'] );
48
49 }
50 $output .= '</select>';
51
52 return $output; // This is html markup that will be outputted in content elements edit form
53 }
54
55 vc_add_shortcode_param( 'aux_switch', 'auxin_aux_switch_settings_field', ADMIN_JS_URL . 'scripts.js' );
56 function auxin_aux_switch_settings_field( $settings, $value ) {
57
58 $checkedd = $settings['value'] ? 'checked="checked"' : '';
59 return '<div class="av3_container aux_switch">'
60 .'<input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-textinput tt"'
61 . ' ' . ' type="checkbox" value="' . $settings['value'] . '" ' . esc_attr( $checkedd ) . ' >' .
62 '</div>'; // This is html markup that will be outputted in content elements edit form
63 }
64
65 // TODO: We should decide about the fields for this type because normally they should generate automaticly
66 vc_add_shortcode_param( 'aux_multiple_selector', 'aux_multiple_selector_settings_field', ADMIN_JS_URL . 'plugins.js' );
67
68 function aux_multiple_selector_settings_field( $settings, $value ) {
69 return
70 '<label >Multiple selector </label>' .
71 '<div class="section-row-right" >' .
72 '<select name="" id="" class="aux-orig-select2 aux-admin-select2 aux-select2-single" data-value="" style="width:150px" multiple="multiple" >' .
73 '<option value="1" >value 1 </option>' .
74 '<option value="2" >value 2</option>' .
75 '</select>' .
76 '<p >Description if needed</p>' .
77 '</div>' ;
78 }
79
80 }
81
82 /**
83 * Enqueue all my widget's admin scripts
84 */
85 function auxin_widgets_enqueue_scripts(){
86 wp_enqueue_script('auxin_widget');
87
88 }
89 add_action( 'admin_print_scripts-widgets.php', 'auxin_widgets_enqueue_scripts' );
90
91 // Add this to enqueue your scripts on Page Builder too
92 add_action('siteorigin_panel_enqueue_admin_scripts', 'auxin_widgets_enqueue_scripts');
93
94 /**
95 * This part is for adding Auxin font icon to Visual composer icon
96 * this is just temporary and need to move and write in a better manner when it is compelete
97 * TODO: just for now to see it is working
98 */
99
100 // Add Auxin icons to Visual Composer icons
101 $settings = array(
102 'name' => __( 'Auxin Icons', 'auxin-elements' ),
103 'category' => THEME_NAME,
104 'params' => array(
105 array(
106 'type' => 'dropdown',
107 'heading' => __( 'Icon library', 'auxin-elements' ),
108 'value' => array(
109 __( 'Font Awesome', 'auxin-elements' ) => 'fontawesome',
110 __( 'Open Iconic', 'auxin-elements' ) => 'openiconic',
111 __( 'Typicons', 'auxin-elements' ) => 'typicons',
112 __( 'Entypo', 'auxin-elements' ) => 'entypo',
113 __( 'Linecons', 'auxin-elements' ) => 'linecons',
114 __( 'Auxin', 'auxin-elements' ) => 'auxin'
115 ),
116 'admin_label' => true,
117 'param_name' => 'type',
118 'description' => __( 'Select icon library.', 'auxin-elements' )
119 ),
120 array(
121 'type' => 'iconpicker',
122 'heading' => __( 'Icon', 'auxin-elements' ),
123 'param_name' => 'icon_auxin',
124 'value' => 'auxin-icon-basket-1', // default value to backend editor admin_label
125 'settings' => array(
126 'emptyIcon' => false,
127 // default true, display an "EMPTY" icon?
128 'type' => 'auxin',
129 'iconsPerPage' => 4000
130 // default 100, how many icons per/page to display, we use (big number) to display all icons in single page
131 ),
132 'dependency' => array(
133 'element' => 'type',
134 'value' => 'auxin'
135 ),
136 'description' => __( 'Select icon from library.', 'auxin-elements' )
137 ),
138 array(
139 'type' => 'iconpicker',
140 'heading' => __( 'Icon', 'auxin-elements' ),
141 'param_name' => 'icon_fontawesome',
142 'value' => 'fa fa-adjust', // default value to backend editor admin_label
143 'settings' => array(
144 'emptyIcon' => false,
145 // default true, display an "EMPTY" icon?
146 'iconsPerPage' => 4000
147 // default 100, how many icons per/page to display, we use (big number) to display all icons in single page
148 ),
149 'dependency' => array(
150 'element' => 'type',
151 'value' => 'fontawesome'
152 ),
153 'description' => __( 'Select icon from library.', 'auxin-elements' )
154 ),
155 array(
156 'type' => 'iconpicker',
157 'heading' => __( 'Icon', 'auxin-elements' ),
158 'param_name' => 'icon_openiconic',
159 'value' => 'vc-oi vc-oi-dial', // default value to backend editor admin_label
160 'settings' => array(
161 'emptyIcon' => false, // default true, display an "EMPTY" icon?
162 'type' => 'openiconic',
163 'iconsPerPage' => 4000 // default 100, how many icons per/page to display
164 ),
165 'dependency' => array(
166 'element' => 'type',
167 'value' => 'openiconic'
168 ),
169 'description' => __( 'Select icon from library.', 'auxin-elements' )
170 ),
171 array(
172 'type' => 'iconpicker',
173 'heading' => __( 'Icon', 'auxin-elements' ),
174 'param_name' => 'icon_typicons',
175 'value' => 'typcn typcn-adjust-brightness', // default value to backend editor admin_label
176 'settings' => array(
177 'emptyIcon' => false, // default true, display an "EMPTY" icon?
178 'type' => 'typicons',
179 'iconsPerPage' => 4000 // default 100, how many icons per/page to display
180 ),
181 'dependency' => array(
182 'element' => 'type',
183 'value' => 'typicons'
184 ),
185 'description' => __( 'Select icon from library.', 'auxin-elements' )
186 ),
187 array(
188 'type' => 'iconpicker',
189 'heading' => __( 'Icon', 'auxin-elements' ),
190 'param_name' => 'icon_entypo',
191 'value' => 'entypo-icon entypo-icon-note', // default value to backend editor admin_label
192 'settings' => array(
193 'emptyIcon' => false, // default true, display an "EMPTY" icon?
194 'type' => 'entypo',
195 'iconsPerPage' => 4000 // default 100, how many icons per/page to display
196 ),
197 'dependency' => array(
198 'element' => 'type',
199 'value' => 'entypo'
200 ),
201 ),
202 array(
203 'type' => 'iconpicker',
204 'heading' => __( 'Icon', 'auxin-elements' ),
205 'param_name' => 'icon_linecons',
206 'value' => 'vc_li vc_li-heart', // default value to backend editor admin_label
207 'settings' => array(
208 'emptyIcon' => false, // default true, display an "EMPTY" icon?
209 'type' => 'linecons',
210 'iconsPerPage' => 4000 // default 100, how many icons per/page to display
211 ),
212 'dependency' => array(
213 'element' => 'type',
214 'value' => 'linecons'
215 ),
216 'description' => __( 'Select icon from library.', 'auxin-elements' ),
217 ),
218
219 array(
220 'type' => 'colorpicker',
221 'heading' => __( 'Custom color', 'auxin-elements' ),
222 'param_name' => 'custom_color',
223 'description' => __( 'Select custom icon color.', 'auxin-elements' ),
224 'dependency' => array(
225 'element' => 'color',
226 'value' => 'custom'
227 ),
228 ),
229 array(
230 'type' => 'dropdown',
231 'heading' => __( 'Background shape', 'auxin-elements' ),
232 'param_name' => 'background_style',
233 'value' => array(
234 __( 'None', 'auxin-elements' ) => '',
235 __( 'Circle', 'auxin-elements' ) => 'rounded',
236 __( 'Square', 'auxin-elements' ) => 'boxed',
237 __( 'Rounded', 'auxin-elements' ) => 'rounded-less',
238 __( 'Outline Circle', 'auxin-elements' ) => 'rounded-outline',
239 __( 'Outline Square', 'auxin-elements' ) => 'boxed-outline',
240 __( 'Outline Rounded', 'auxin-elements' ) => 'rounded-less-outline'
241 ),
242 'description' => __( 'Select background shape and style for icon.', 'auxin-elements' )
243 ),
244
245 array(
246 'type' => 'colorpicker',
247 'heading' => __( 'Custom background color', 'auxin-elements' ),
248 'param_name' => 'custom_background_color',
249 'description' => __( 'Select custom icon background color.', 'auxin-elements' ),
250 'dependency' => array(
251 'element' => 'background_color',
252 'value' => 'custom'
253 ),
254 ),
255
256 array(
257 'type' => 'dropdown',
258 'heading' => __( 'Icon alignment', 'auxin-elements' ),
259 'param_name' => 'align',
260 'value' => array(
261 __( 'Left', 'auxin-elements' ) => 'left',
262 __( 'Right', 'auxin-elements' ) => 'right',
263 __( 'Center', 'auxin-elements' ) => 'center'
264 ),
265 'description' => __( 'Select icon alignment.', 'auxin-elements' ),
266 ),
267
268 ),
269
270 );
271
272 if ( defined( 'WPB_VC_VERSION' ) ) {
273
274 vc_map_update('vc_icon', $settings );
275
276 // TODO: This is a sample we need to create an array for all the icons and also enque its css file
277 add_filter( 'vc_iconpicker-type-auxin', 'vc_iconpicker_type_auxin' );
278 function vc_iconpicker_type_auxin( $icons ) {
279 $auxin_icons = array(
280 "Test" => array(
281 array( 'auxin-icon auxin-icon-2-arrows' => __( 'Arrow', 'auxin-elements' ) ),
282 array( 'auxin-icon auxin-icon-basket-1' => __( 'Arrow', 'auxin-elements' ) ),
283 array( 'auxin-icon auxin-icon-back-pack' => __( 'Back', 'auxin-elements' ) )
284 )
285 );
286
287 return array_merge( $icons, $auxin_icons );
288 }
289
290 add_action( 'vc_backend_editor_enqueue_js_css', 'auxin_vc_iconpicker_editor_jscss' );
291 // @see Vc_Frontend_Editor::enqueueAdmin (wp-content/plugins/js_composer/include/classes/editors/class-vc-frontend-editor.php),
292 // used to enqueue needed js/css files when frontend editor is rendering
293 add_action( 'vc_frontend_editor_enqueue_js_css', 'auxin_vc_iconpicker_editor_jscss' );
294 function auxin_vc_iconpicker_editor_jscss () {
295 wp_enqueue_style( 'auxin_font' );
296 }
297
298 // @see Vc_Base::frontCss, used to append actions when frontCss(frontend editor/and real view mode) method called
299 // This action registers all styles(fonts) to be enqueue later
300 add_action( 'vc_base_register_front_css', 'auxin_vc_iconpicker_base_register_css' );
301
302 // @see Vc_Base::registerAdminCss, used to append action when registerAdminCss(backend editor) method called
303 // This action registers all styles(fonts) to be enqueue later
304 add_action( 'vc_base_register_admin_css', 'auxin_vc_iconpicker_base_register_css' );
305 function auxin_vc_iconpicker_base_register_css () {
306 wp_register_style( 'auxin_font', vc_asset_url( 'css/lib/auxin-font/auxin-font.css' ), false, WPB_VC_VERSION, 'screen' );
307 }
308
309
310 }
311
312 }
313 add_action( 'auxin_admin_loaded', 'auxin_add_vc_field_types' );
314
315
316 /**
317 * load custom shortcodes, templates and element in visual composer start
318 *
319 * @return void
320 */
321 function auxin_on_vc_plugin_loaded(){
322 global $vc_manager;
323 if( ! is_null( $vc_manager ) ) {
324 $auxin_shortcodes_template_dir = AUXELS_PUB_DIR . '/templates/vcomposer';
325 $vc_manager->setCustomUserShortcodesTemplateDir( $auxin_shortcodes_template_dir );
326 }
327 }
328 add_action( 'plugins_loaded', 'auxin_on_vc_plugin_loaded' );
329
330
331
332 function auxin_add_theme_options_in_plugin( $fields_sections_list ){
333
334 // Sub section - Custom JS ------------------------------------
335
336 $fields_sections_list['sections'][] = array(
337 'id' => 'general-setting-section-custom-js',
338 'parent' => 'general-setting-section', // section parent's id
339 'title' => __( 'Custom JS Code', 'auxin-elements'),
340 'description' => __( 'Your Custom Javascript', 'auxin-elements')
341 );
342
343 $fields_sections_list['fields'][] = array(
344 'title' => __('Custom Javascript', 'auxin-elements'),
345 'description' => sprintf( __('You can add your custom javascript code here.%s No need to use %s tag', 'auxin-elements'), '<br />' , '<code>&lt;script&gt;</code>' )."<br />".
346 __('In order to save your custom javascript code, you are expected to execute the code prior to saving.', 'auxin-elements'),
347 'id' => 'auxin_user_custom_js',
348 'section' => 'general-setting-section-custom-js',
349 'dependency' => array(),
350 'default' => '',
351 'transport' => 'postMessage',
352 'button_labels' => array( 'label' => __('Execute', 'auxin-elements') ),
353 'mode' => 'javascript',
354 'type' => 'code'
355 );
356
357
358 // Sub section - SEO ----------------------------------
359
360 $fields_sections_list['sections'][] = array(
361 'id' => 'general-setting-section-seo',
362 'parent' => 'general-setting-section', // section parent's id
363 'title' => __( 'Tracking & SEO', 'auxin-elements'),
364 'description' => __( 'Tracking & SEO', 'auxin-elements')
365 );
366
367
368 $fields_sections_list['fields'][] = array(
369 'title' => __('Enable built in SEO?', 'auxin-elements'),
370 'description' => __('If you want to use SEO plugins like "WordPress SEO by Yoast" or "All in One SEO Pack" you can disable built-in SEO for maximum compatibility by checking this option',
371 'auxin-elements'),
372 'id' => 'enable_theme_seo',
373 'section' => 'general-setting-section-seo',
374 'dependency' => array(),
375 'default' => '1',
376 'type' => 'switch'
377 );
378
379 $fields_sections_list['fields'][] = array(
380 'title' => __('Google analytics code', 'auxin-elements'),
381 'description' => __('You can add your Google analytics code here. Do NOT use <code>&lt;script&gt;</code> tag', 'auxin-elements'),
382 'id' => 'auxin_user_google_analytics',
383 'section' => 'general-setting-section-seo',
384 'dependency' => array(),
385 'default' => '',
386 'transport' => 'postMessage',
387 'mode' => 'javascript',
388 'button_labels' => array( 'label' => false ),
389 'type' => 'code'
390 );
391
392 $fields_sections_list['fields'][] = array(
393 'title' => __('Google marketing code', 'auxin-elements'),
394 'description' => __('You can add your Google marketing code here. Do NOT use <code>&lt;script&gt;</code> tag', 'auxin-elements'),
395 'id' => 'auxin_user_google_marketing',
396 'section' => 'general-setting-section-seo',
397 'dependency' => array(),
398 'default' => '',
399 'transport' => 'postMessage',
400 'mode' => 'javascript',
401 'button_labels' => array( 'label' => false ),
402 'type' => 'code'
403 );
404
405
406
407
408
409
410 // Sub section - Login page customizer -------------------------------
411
412 $fields_sections_list['sections'][] = array(
413 'id' => 'tools-setting-section-login',
414 'parent' => 'tools-setting-section', // section parent's id
415 'title' => __( 'Login Page', 'auxin-elements'),
416 'description' => __( 'Preview login page', 'auxin-elements') . ' '. sprintf(
417 '<a href="%s" class="section-title-icon axicon-link-ext" target="_self" title="%s" ></a>',
418 '?url='.wp_login_url(), __('Preview login page', 'auxin-elements')
419 )
420 );
421
422
423
424 $fields_sections_list['fields'][] = array(
425 'title' => __('Login Skin', 'auxin-elements'),
426 'description' => __('Specifies a skin for login page of your website.', 'auxin-elements'),
427 'id' => 'auxin_login_skin',
428 'section' => 'tools-setting-section-login',
429 'dependency' => array(),
430 'choices' => array(
431 'default' => array(
432 'label' => __('Default', 'auxin-elements'),
433 'image' => AUX_URL . 'images/visual-select/login-skin-default.svg'
434 ),
435 'clean-white' => array(
436 'label' => __('Clean white', 'auxin-elements'),
437 'image' => AUX_URL . 'images/visual-select/login-skin-light.svg'
438 ),
439 'simple-white' => array(
440 'label' => __('Simple white', 'auxin-elements'),
441 'image' => AUX_URL . 'images/visual-select/login-skin-simple-light.svg'
442 ),
443 'simple-gray' => array(
444 'label' => __('Simple gray', 'auxin-elements'),
445 'image' => AUX_URL . 'images/visual-select/login-skin-simple-gray.svg'
446 )
447 ),
448 'transport' => 'refresh',
449 'default' => 'default',
450 'type' => 'radio-image'
451 );
452
453 $fields_sections_list['fields'][] = array(
454 'title' => __('Login message', 'auxin-elements'),
455 'description' => __('If you enter a text, it displays above of login form.', 'auxin-elements'),
456 'id' => 'auxin_login_message',
457 'section' => 'tools-setting-section-login',
458 'dependency' => array(),
459 'transport' => 'refresh',
460 'type' => 'textarea',
461 'default' => ''
462 );
463
464 //--------------------------------
465
466 $fields_sections_list['fields'][] = array(
467 'title' => __('Login Page Logo', 'auxin-elements'),
468 'description' => __('Specifies a logo to display on login page.(the width of logo image could be up to 320px)', 'auxin-elements'),
469 'id' => 'auxin_login_logo_image',
470 'section' => 'tools-setting-section-login',
471 'dependency' => array(),
472 'transport' => 'refresh',
473 'default' => '',
474 'type' => 'image'
475 );
476
477
478 $fields_sections_list['fields'][] = array(
479 'title' => __('Logo Width', 'auxin-elements'),
480 'description' => __('Specifies the width of logo image in pixel.', 'auxin-elements'),
481 'id' => 'auxin_login_logo_width',
482 'section' => 'tools-setting-section-login',
483 'dependency' => array(),
484 'transport' => 'refresh',
485 'default' => '84',
486 'type' => 'text'
487 );
488
489
490 $fields_sections_list['fields'][] = array(
491 'title' => __('Logo Height', 'auxin-elements'),
492 'description' => __('Specifies the height of logo image in pixel.', 'auxin-elements'),
493 'id' => 'auxin_login_logo_height',
494 'section' => 'tools-setting-section-login',
495 'dependency' => array(),
496 'transport' => 'refresh',
497 'default' => '84',
498 'type' => 'text'
499 );
500
501 //--------------------------------
502
503 $fields_sections_list['fields'][] = array(
504 'title' => __('Enable Background?', 'auxin-elements'),
505 'description' => __('Enable it to display custom background on login page.', 'auxin-elements'),
506 'id' => 'auxin_login_bg_show',
507 'section' => 'tools-setting-section-login',
508 'type' => 'switch',
509 'transport' => 'refresh',
510 'wrapper_class' => 'collapse-head',
511 'default' => '0'
512 );
513
514
515 $fields_sections_list['fields'][] = array(
516 'title' => __( 'Background Color', 'auxin-elements'),
517 'id' => 'auxin_login_bg_color',
518 'description' => __( 'Specifies the color of website background', 'auxin-elements'),
519 'section' => 'tools-setting-section-login',
520 'type' => 'color',
521 'dependency' => array(
522 array(
523 'id' => 'auxin_login_bg_show',
524 'value' => array( '1' )
525 )
526 ),
527 'transport' => 'refresh',
528 'default' => ''
529 );
530
531 $fields_sections_list['fields'][] = array(
532 'title' => __('Background Image', 'auxin-elements'),
533 'id' => 'auxin_login_bg_image',
534 'description' => __('You can upload custom image for site background', 'auxin-elements').'<br/>'.__('Note: if you set custom image, default image backgrounds will be ignored', 'auxin-elements'),
535 'section' => 'tools-setting-section-login',
536 'type' => 'image',
537 'dependency' => array(
538 array(
539 'id' => 'auxin_login_bg_show',
540 'value' => array( '1' )
541 )
542 ),
543 'transport' => 'refresh',
544 'default' => ''
545 );
546
547 $fields_sections_list['fields'][] = array(
548 'title' => __('Background Size', 'auxin-elements'),
549 'description' => __('Specifies the background size.', 'auxin-elements'),
550 'id' => 'auxin_login_bg_size',
551 'section' => 'tools-setting-section-login',
552 'type' => 'radio-image',
553 'choices' => array(
554 'auto' => array(
555 'label' => __('Auto', 'auxin-elements'),
556 'css_class' => 'axiAdminIcon-bg-size-1',
557 ),
558 'contain' => array(
559 'label' => __('Contain', 'auxin-elements'),
560 'css_class' => 'axiAdminIcon-bg-size-2'
561 ),
562 'cover' => array(
563 'label' => __('Cover', 'auxin-elements'),
564 'css_class' => 'axiAdminIcon-bg-size-3'
565 )
566 ),
567 'dependency' => array(
568 array(
569 'id' => 'auxin_login_bg_show',
570 'value' => array( '1' )
571 )
572 ),
573 'transport' => 'refresh',
574 'default' => 'auto'
575 );
576
577 $fields_sections_list['fields'][] = array(
578 'title' => __('Background Pattern', 'auxin-elements'),
579 'description' => __('Here you can select one of these patterns as site image background.', 'auxin-elements'),
580 'id' => 'auxin_login_bg_pattern',
581 'section' => 'tools-setting-section-login',
582 'choices' => auxin_get_background_patterns( array( 'none' => array( 'label' =>__('None', 'auxin-elements'), 'image' => AUX_URL . 'images/visual-select/none-pattern.svg' ) ), 'before' ),
583 'type' => 'radio-image',
584 'dependency' => array(
585 array(
586 'id' => 'auxin_login_bg_show',
587 'value' => array( '1' )
588 )
589 ),
590 'transport' => 'refresh',
591 'default' => ''
592 );
593
594 $fields_sections_list['fields'][] = array(
595 'title' => __( 'Background Repeat', 'auxin-elements'),
596 'description' => __( 'Specifies how background image repeats.', 'auxin-elements'),
597 'id' => 'auxin_login_bg_repeat',
598 'section' => 'tools-setting-section-login',
599 'choices' => array(
600 'no-repeat' => array(
601 'label' => __('No repeat', 'auxin-elements'),
602 'css_class' => 'axiAdminIcon-none',
603 ),
604 'repeat' => array(
605 'label' => __('Repeat horizontally and vertically', 'auxin-elements'),
606 'css_class' => 'axiAdminIcon-repeat-xy',
607 ),
608 'repeat-x' => array(
609 'label' => __('Repeat horizontally', 'auxin-elements'),
610 'css_class' => 'axiAdminIcon-repeat-x',
611 ),
612 'repeat-y' => array(
613 'label' => __('Repeat vertically', 'auxin-elements'),
614 'css_class' => 'axiAdminIcon-repeat-y',
615 )
616 ),
617 'type' => 'radio-image',
618 'dependency' => array(
619 array(
620 'id' => 'auxin_login_bg_show',
621 'value' => array( '1' )
622 )
623 ),
624 'transport' => 'refresh',
625 'default' => 'no-repeat'
626 );
627
628 $fields_sections_list['fields'][] = array(
629 'title' => __( 'Background Position', 'auxin-elements'),
630 'description' => __('Specifies background image alignment.', 'auxin-elements'),
631 'id' => 'auxin_login_bg_position',
632 'section' => 'tools-setting-section-login',
633 'choices' => array(
634 'left top' => array(
635 'label' => __('Left top', 'auxin-elements'),
636 'css_class' => 'axiAdminIcon-top-left'
637 ),
638 'center top' => array(
639 'label' => __('Center top', 'auxin-elements'),
640 'css_class' => 'axiAdminIcon-top-center'
641 ),
642 'right top' => array(
643 'label' => __('Right top', 'auxin-elements'),
644 'css_class' => 'axiAdminIcon-top-right'
645 ),
646
647 'left center' => array(
648 'label' => __('Left center', 'auxin-elements'),
649 'css_class' => 'axiAdminIcon-center-left'
650 ),
651 'center center' => array(
652 'label' => __('Center center', 'auxin-elements'),
653 'css_class' => 'axiAdminIcon-center-center'
654 ),
655 'right center' => array(
656 'label' => __('Right center', 'auxin-elements'),
657 'css_class' => 'axiAdminIcon-center-right'
658 ),
659
660 'left bottom' => array(
661 'label' => __('Left bottom', 'auxin-elements'),
662 'css_class' => 'axiAdminIcon-bottom-left'
663 ),
664 'center bottom' => array(
665 'label' => __('Center bottom', 'auxin-elements'),
666 'css_class' => 'axiAdminIcon-bottom-center'
667 ),
668 'right bottom' => array(
669 'label' => __('Right bottom', 'auxin-elements'),
670 'css_class' => 'axiAdminIcon-bottom-right'
671 )
672 ),
673 'type' => 'radio-image',
674 'dependency' => array(
675 array(
676 'id' => 'auxin_login_bg_show',
677 'value' => array( '1' )
678 )
679 ),
680 'transport' => 'refresh',
681 'default' => 'left top'
682 );
683
684 $fields_sections_list['fields'][] = array(
685 'title' => __('Background Attachment', 'auxin-elements'),
686 'description' => __('Specifies whether the background is fixed or scrollable as user scrolls the document.', 'auxin-elements'),
687 'id' => 'auxin_login_bg_attach',
688 'section' => 'tools-setting-section-login',
689 'type' => 'radio-image',
690 'choices' => array(
691 'scroll' => array(
692 'label' => __('Scroll', 'auxin-elements'),
693 'css_class' => 'axiAdminIcon-bg-attachment-scroll',
694 ),
695 'fixed' => array(
696 'label' => __('Fixed', 'auxin-elements'),
697 'css_class' => 'axiAdminIcon-bg-attachment-fixed',
698 )
699 ),
700 'dependency' => array(
701 array(
702 'id' => 'auxin_login_bg_show',
703 'value' => array( '1' )
704 )
705 ),
706 'transport' => 'refresh',
707 'default' => 'scroll'
708 );
709
710 //--------------------------------
711
712 $fields_sections_list['fields'][] = array(
713 'title' => __('Custom CSS class name', 'auxin-elements'),
714 'description' => __('In this field you can define custom CSS class name for login page.
715 This class name will be added to body classes in login page and is useful for advance custom styling purposes.', 'auxin-elements'),
716 'id' => 'auxin_login_body_class',
717 'section' => 'tools-setting-section-login',
718 'dependency' => array(),
719 'transport' => 'refresh',
720 'default' => '',
721 'type' => 'text'
722 );
723
724
725 return $fields_sections_list;
726 }
727
728 add_filter( 'auxin_defined_option_fields_sections', 'auxin_add_theme_options_in_plugin', 12, 1 );
729
730
731
732 /*-----------------------------------------------------------------------------------*/
733 /* Injects JavaScript codes from theme options in JS file
734 /*-----------------------------------------------------------------------------------*/
735
736 function auxin_ele_add_theme_options_to_js_file( $js ){
737 $js['theme_options_custom'] = auxin_get_option( 'auxin_user_custom_js' );
738
739 $js['theme_options_google_analytics'] = auxin_get_option( 'auxin_user_google_analytics' );
740 $js['theme_options_google_marketing'] = auxin_get_option( 'auxin_user_google_marketing' );
741
742 // Will be deprecated in version 1.4
743 unset( $js['option_panel_custom'] );
744 unset( $js['option_panel_google_analytics'] );
745 unset( $js['option_panel_google_marketing'] );
746
747 return $js;
748 }
749 add_filter( 'auxin_custom_js_file_content', 'auxin_ele_add_theme_options_to_js_file' );
750
751
752 /*-----------------------------------------------------------------------------------*/
753 /* Adds the custom CSS class of the login page to body element
754 /*-----------------------------------------------------------------------------------*/
755
756 function auxin_login_body_class( $classes ){
757
758 if( $custom_class = auxin_get_option('auxin_login_body_class' ) ){
759 $classes['auxin_custom'] = $custom_class;
760 }
761
762 if( $custom_skin = auxin_get_option('auxin_login_skin' ) ){
763 $classes['auxin_skin'] = esc_attr( 'auxin-login-skin-' . $custom_skin );
764 }
765
766 return $classes;
767 }
768 add_action( 'auxin_functions_ready', function(){
769 add_filter( 'login_body_class', 'auxin_login_body_class' );
770 });
771
772
773
774 /*-----------------------------------------------------------------------------------*/
775 /* Adds proper styles for background and logo on login page
776 /*-----------------------------------------------------------------------------------*/
777
778 function auxin_login_head(){
779
780 $styles = '';
781
782 if( $bg_image_id = auxin_get_option( 'auxin_login_logo_image' ) ){
783 $bg_image = wp_get_attachment_url( $bg_image_id );
784 $styles .= "background-image: url( $bg_image ); ";
785
786 $bg_width = auxin_get_option( 'auxin_login_logo_width' , '84' );
787 $bg_height = auxin_get_option( 'auxin_login_logo_height', '84' );
788
789 $bg_width = rtrim( $bg_width , 'px' ) . 'px';
790 $bg_height = rtrim( $bg_height, 'px' ) . 'px';
791
792 $styles .= "background-size: $bg_width $bg_height; ";
793 $styles .= "width: $bg_width; height: $bg_height; ";
794
795 echo "<style>#login h1 a { $styles }</style>";
796 }
797
798 if( auxin_get_option( 'auxin_login_bg_show' ) ){
799
800 // get styles for background image
801 $bg_styles = auxin_generate_styles_for_backgroud_fields( 'auxin_login_bg', 'option', array(
802 'color' => 'auxin_login_bg_color',
803 'image' => 'auxin_login_bg_image',
804 'repeat' => 'auxin_login_bg_repeat',
805 'size' => 'auxin_login_bg_size',
806 'position' => 'auxin_login_bg_position',
807 'attachment' => 'auxin_login_bg_attachment',
808 'clip' => 'auxin_login_bg_clip'
809 ) );
810
811 $pattern_style = auxin_generate_styles_for_backgroud_fields( 'auxin_login_bg', 'option', array(
812 'pattern' => 'auxin_login_bg_pattern'
813 ) );
814
815 echo "<style>body.login { $bg_styles } body.login:before { $pattern_style }</style>";
816 }
817
818 }
819 add_action( 'auxin_functions_ready', function(){
820 add_action( 'login_head', 'auxin_login_head' );
821 });
822
823
824 /*-----------------------------------------------------------------------------------*/
825 /* Changes the login header url to home url
826 /*-----------------------------------------------------------------------------------*/
827
828 function auxin_login_headerurl( $login_header_url ){
829
830 if ( ! is_multisite() ) {
831 $login_header_url = home_url();
832 }
833 return $login_header_url;
834 }
835 add_action( 'auxin_functions_ready', function(){
836 add_filter( 'login_headerurl', 'auxin_login_headerurl' );
837 });
838
839 /*-----------------------------------------------------------------------------------*/
840 /* Changes the login header url to home url
841 /*-----------------------------------------------------------------------------------*/
842
843 function auxin_login_headertitle( $login_header_title ){
844
845 if ( ! is_multisite() ) {
846 $login_header_title = get_bloginfo( 'name' );
847 }
848 return $login_header_title;
849 }
850 add_action( 'auxin_functions_ready', function(){
851 add_filter( 'login_headertitle', 'auxin_login_headertitle' );
852 });
853
854 /*-----------------------------------------------------------------------------------*/
855 /* Adds custom message above the login form
856 /*-----------------------------------------------------------------------------------*/
857
858 function auxin_login_message( $login_message ){
859
860 if( $custom_message = auxin_get_option( 'auxin_login_message' ) ){
861
862 $message_wrapper_start = '<div class="message">';
863 $message_wrapper_end = "</div>\n";
864
865 $custom_message_markup = $message_wrapper_start . $custom_message . $message_wrapper_end;
866
867 /**
868 * Filter instructional messages displayed above the login form.
869 *
870 * @param string $custom_message Login message.
871 */
872 $login_message .= apply_filters( 'auxin_login_message', $custom_message_markup, $custom_message, $message_wrapper_start, $message_wrapper_end );
873 }
874
875 return $login_message;
876 }
877 add_action( 'auxin_functions_ready', function(){
878 add_filter( 'login_message', 'auxin_login_message' );
879 });
880
881
882 /*-----------------------------------------------------------------------------------*/
883 /* Prints the custom js codes of a single page to the source page
884 /*-----------------------------------------------------------------------------------*/
885
886 function auxin_custom_js_for_pages( $js, $post ){
887 // The custom JS code for specific page
888 if( $post && ! is_404() && is_singular() ) {
889 $js .= get_post_meta( $post->ID, 'aux_page_custom_js', true );
890 }
891
892 }
893 add_filter( 'auxin_footer_inline_script', 'auxin_custom_js_for_pages', 15, 2 );
894
895
896 /*-----------------------------------------------------------------------------------*/
897 /* Print meta tags to preview post while sharing on facebook
898 /*-----------------------------------------------------------------------------------*/
899
900 if( ! defined('WPSEO_VERSION') && ! class_exists('All_in_One_SEO_Pack') ){
901
902 function auxin_facebook_header_meta (){
903
904 if( ! defined('AUXIN_VERSION') ){
905 return;
906 }
907
908 // return if built-in seo is disabled or "SEO by yoast" is active
909 if( ! auxin_get_option( 'enable_theme_seo', 1 ) ) return;
910
911 global $post;
912 if( ! isset( $post ) || ! is_singular() || is_search() || is_404() ) return;
913 setup_postdata( $post );
914
915 $featured_image = auxin_get_the_post_thumbnail_src( $post->ID, 90, 90, true, 90 );
916 $post_excerpt = get_the_excerpt();
917 ?>
918 <meta name="title" content="<?php echo esc_attr( $post->post_title ); ?>" />
919 <meta name="description" content="<?php echo esc_attr( $post_excerpt ); ?>" />
920 <?php if( $featured_image) { ?>
921 <link rel="image_src" href="<?php echo $featured_image; ?>" />
922 <?php }
923
924 }
925
926 add_action( 'wp_head', 'auxin_facebook_header_meta' );
927 }
928
929 /*-----------------------------------------------------------------------------------*/
930