PluginProbe ʕ •ᴥ•ʔ
Catch Scroll Progress Bar / 1.5
Catch Scroll Progress Bar v1.5
trunk 1.0.0 1.1 1.2 1.3 1.4 1.5 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 2.0 2.1 2.2
catch-scroll-progress-bar / includes / ctp-tabs-removal.php
catch-scroll-progress-bar / includes Last commit date
CatchThemesThemePlugin.php 4 years ago class-catch-scroll-progress-bar-activator.php 4 years ago class-catch-scroll-progress-bar-deactivator.php 4 years ago class-catch-scroll-progress-bar-i18n.php 4 years ago class-catch-scroll-progress-bar-loader.php 4 years ago class-catch-scroll-progress-bar.php 4 years ago ctp-tabs-removal.php 4 years ago index.php 4 years ago
ctp-tabs-removal.php
75 lines
1 <?php
2 /**
3 * ctp_register_settings
4 * Header Enhacement Pro Register Settings
5 */
6 if( ! function_exists( 'ctp_register_settings' ) ) {
7 function ctp_register_settings() {
8 // register_setting( $option_group, $option_name, $sanitize_callback )
9 register_setting(
10 'ctp-group',
11 'ctp_options',
12 array()
13 );
14 }
15 }
16 add_action( 'admin_init', 'ctp_register_settings' );
17
18 if( ! function_exists( 'ctp_get_options' ) ) {
19 /**
20 * Returns the options array for ctp_get options
21 *
22 * @since 1.9
23 */
24 function ctp_get_options(){
25 $defaults = ctp_default_options();
26 $options = get_option( 'ctp_options', $defaults );
27
28 return wp_parse_args( $options, $defaults ) ;
29 }
30 }
31
32 if( ! function_exists( 'ctp_default_options' ) ) {
33 /**
34 * Return array of default options
35 *
36 * @since 1.9
37 * @return string 1 or 2.
38 */
39 function ctp_default_options( $option = null ) {
40 $default_options['theme_plugin_tabs'] = 1;
41 if ( null == $option ) {
42 return apply_filters( 'ctp_options', $default_options );
43 }
44 else {
45 return $default_options[ $option ];
46 }
47 }
48 }
49
50 if( ! function_exists( 'ctp_switch' ) ){
51 /**
52 * Return $string
53 *
54 * @since 1.2
55 * @return $string 1 or 2.
56 */
57 function ctp_switch() {
58 $value = ( 'true' == $_POST['value'] ) ? 1 : 0;
59
60 $option_name = $_POST['option_name'];
61
62 $option_value = ctp_get_options();
63
64 $option_value[$option_name] = $value;
65
66 if( update_option( 'ctp_options', $option_value ) ) {
67 echo $value;
68 } else {
69 esc_html_e( 'Connection Error. Please try again.', 'to-top' );
70 }
71
72 wp_die(); // this is required to terminate immediately and return a proper response
73 }
74 }
75 add_action( 'wp_ajax_ctp_switch', 'ctp_switch' );