vk-all-in-one-expansion-unit
Last commit date
_scss
8 years ago
css
8 years ago
images
8 years ago
js
8 years ago
languages
8 years ago
libraries
8 years ago
plugins
8 years ago
plugins_admin
8 years ago
admin_active_setting_page.php
8 years ago
admin_main_setting_page.php
8 years ago
admin_other_functions.php
8 years ago
common_helpers.php
8 years ago
common_init.php
8 years ago
initialize.php
8 years ago
readme.txt
8 years ago
screenshot-1.png
8 years ago
screenshot-2.png
8 years ago
uninstaller.php
8 years ago
veu-package-manager.php
8 years ago
veu-packages.php
8 years ago
vkExUnit.php
8 years ago
common_init.php
60 lines
| 1 | <?php |
| 2 | function vkExUnit_common_options_init() { |
| 3 | register_setting( |
| 4 | 'vkExUnit_common_options_fields', // Immediately following form tag of edit page. |
| 5 | 'vkExUnit_common_options', // name attr |
| 6 | 'vkExUnit_common_options_validate' |
| 7 | ); |
| 8 | } |
| 9 | add_action( 'admin_init', 'vkExUnit_common_options_init' ); |
| 10 | |
| 11 | function vkExUnit_get_common_options() { |
| 12 | $options = get_option( 'vkExUnit_common_options', vkExUnit_get_common_options_default() ); |
| 13 | $options_dafault = vkExUnit_get_common_options_default(); |
| 14 | return apply_filters( 'vkExUnit_common_options', $options ); |
| 15 | } |
| 16 | |
| 17 | function vkExUnit_get_common_options_default() { |
| 18 | // hook vkExUnit_package_is_enable() |
| 19 | $default_options = array( |
| 20 | 'active_bootstrap' => false, |
| 21 | 'active_fontawesome' => false, |
| 22 | 'active_metaDescription' => true, |
| 23 | 'active_metaKeyword' => true, |
| 24 | 'active_wpTitle' => true, |
| 25 | 'active_sns' => true, |
| 26 | 'active_ga' => true, |
| 27 | 'active_relatedPosts' => true, |
| 28 | 'active_call_to_action' => true, |
| 29 | 'active_pageList_ancestor' => true, |
| 30 | 'active_childPageIndex' => true, |
| 31 | 'delete_options_at_deactivate' => false, |
| 32 | 'delete_options_with_bizvektors_common' => true, |
| 33 | 'content_filter_state' => 'content', |
| 34 | ); |
| 35 | return apply_filters( 'vkExUnit_common_options_default', $default_options ); |
| 36 | } |
| 37 | |
| 38 | /*-------------------------------------------*/ |
| 39 | /* validate |
| 40 | /*-------------------------------------------*/ |
| 41 | |
| 42 | function vkExUnit_common_options_validate( $input ) { |
| 43 | $output = $defaults = vkExUnit_get_common_options_default(); |
| 44 | $output['active_bootstrap'] = ( ! empty( $input['active_bootstrap'] ) ) ? true : false; |
| 45 | $output['active_fontawesome'] = ( ! empty( $input['active_fontawesome'] ) ) ? true : false; |
| 46 | $output['active_metaDescription'] = ( ! empty( $input['active_metaDescription'] ) ) ? true : false; |
| 47 | $output['active_metaKeyword'] = ( ! empty( $input['active_metaKeyword'] ) ) ? true : false; |
| 48 | $output['active_icon'] = ( ! empty( $input['active_icon'] ) ) ? true : false; |
| 49 | $output['active_wpTitle'] = ( ! empty( $input['active_wpTitle'] ) ) ? true : false; |
| 50 | $output['active_sns'] = ( ! empty( $input['active_sns'] ) ) ? true : false; |
| 51 | $output['active_ga'] = ( ! empty( $input['active_ga'] ) ) ? true : false; |
| 52 | $output['active_relatedPosts'] = ( ! empty( $input['active_relatedPosts'] ) ) ? true : false; |
| 53 | $output['active_otherWidgets'] = ( ! empty( $input['active_otherWidgets'] ) ) ? true : false; |
| 54 | $output['active_css_customize'] = ( ! empty( $input['active_css_customize'] ) ) ? true : false; |
| 55 | $output['active_call_to_action'] = ( ! empty( $input['active_call_to_action'] ) ) ? true : false; |
| 56 | $output['delete_options_at_deactivate'] = ( ! empty( $input['delete_options_at_deactivate'] ) ) ? true : false; |
| 57 | $output['content_filter_state'] = ( ! empty( $input['content_filter_state'] ) ) ? 'loop_end' : 'content'; |
| 58 | return apply_filters( 'vkExUnit_common_options_validate', $output, $input, $defaults ); |
| 59 | } |
| 60 |