'wpbm_version_num' , 'option-is_delete_if_deactive' => 'wpbm_is_delete_if_deactive' , 'option-activation_process' => 'wpbm_activation_process' , 'transient-wpbm_activation_redirect' => '_wpbm_activation_redirect' , 'message-delete_data' => '' . __('Warning!', 'booking-manager') . ' ' . __('All plugin data will be deleted when the plugin is deactivated.', 'booking-manager') . '
' . sprintf( __('If you want to save your plugin data, please uncheck the %s"Delete data"%s at the' , 'booking-manager') , '', '') . ' ' . __('settings page', 'booking-manager') . '.' . ' ' , 'link_settings' => ''.__("Settings", 'booking-manager').'' , 'link_whats_new' => '' ); } /** Check if was updated from lower to high version */ public function is_update_from_lower_to_high_version() { $is_make_activation = false; //TODO: Set here correct Table Name about checking upgrade // // Check conditions for different version about Upgrade if ( ( class_exists( 'wpbm_personal' ) ) && ( ! wpbm_is_table_exists( 'itemtypes' ) ) ) $is_make_activation = true; return $is_make_activation; } } //////////////////////////////////////////////////////////////////////////////// // A c t i v a t e & D e a c t i v a t e //////////////////////////////////////////////////////////////////////////////// /** Activation */ function wpbm_activate() { // Check for blank data install $wpbm_secret_key = get_wpbm_option( 'wpbm_date_format' ); if ( empty( $wpbm_secret_key ) ) $is_first_time_install = true; else $is_first_time_install = false; make_wpbm_action( 'wpbm_before_activation' ); wpbm_load_translation(); $version = get_wpbm_version(); $is_demo = wpbm_is_this_demo(); //////////////////////////////////////////////////////////////////////////// // Options //////////////////////////////////////////////////////////////////////////// $default_options_to_add = wpbm_get_default_options(); foreach ( $default_options_to_add as $default_option_name => $default_option_value ) { add_wpbm_option( $default_option_name, $default_option_value ); } //////////////////////////////////////////////////////////////////////////// // DB Tables //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// // Other versions Activation //////////////////////////////////////////////////////////////////////////// make_wpbm_action( 'wpbm_other_versions_activation' ); make_wpbm_action( 'wpbm_after_activation' ); } add_wpbm_action( 'wpbm_activation', 'wpbm_activate' ); // Deactivate function wpbm_deactivate() { //////////////////////////////////////////////////////////////////////////// // Options //////////////////////////////////////////////////////////////////////////// $default_options_to_add = wpbm_get_default_options(); foreach ( $default_options_to_add as $default_option_name => $default_option_value) { delete_wpbm_option( $default_option_name ); } //////////////////////////////////////////////////////////////////////////// // Widgets //////////////////////////////////////////////////////////////////////////// delete_wpbm_option( 'wpbm_activation_redirect_for_version' ); //////////////////////////////////////////////////////////////////////////// // DB Tables //////////////////////////////////////////////////////////////////////////// global $wpdb; // $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}wpbm" ); // Delete all users item windows states if ( false === $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%wpbm_%'" ) ){ // All users data debuge_error('Error during deleting user meta at DB',__FILE__,__LINE__); die(); } //////////////////////////////////////////////////////////////////////////// // Other versions Deactivation //////////////////////////////////////////////////////////////////////////// make_wpbm_action('wpbm_other_versions_deactivation'); } add_wpbm_action( 'wpbm_deactivation', 'wpbm_deactivate' ); /** Default Options * * $option_name = ''; * $options_for_delete = wpbm_get_default_options( $option_name, $is_get_multiuser_general_options ); */ function wpbm_get_default_options( $option_name = '' ) { $is_demo = wpbm_is_this_demo(); $default_options = array(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // General Settings //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Miscellaneous $default_options[ 'wpbm_start_day_weeek' ] = 0; $default_options[ 'wpbm_date_format' ] = get_option( 'date_format' ); $default_options[ 'wpbm_time_format' ] = get_option( 'time_format' ); // Advanced $default_options[ 'wpbm_is_not_load_bs_script_in_admin' ] = 'Off'; /** $default_options[ 'wpbm_is_not_load_bs_script_in_client' ] = 'Off'; $default_options[ 'wpbm_is_load_js_css_on_specific_pages' ] = 'Off'; $default_options[ 'wpbm_pages_for_load_js_css' ] = ''; */ $default_options[ 'wpbm_menu_position' ] = ( $is_demo ) ? 'bottom' : 'bottom'; // User permissions $default_options[ 'wpbm_user_role_master' ] = ( $is_demo ) ? 'subscriber' : 'editor'; //$default_options[ 'wpbm_user_role_addnew' ] = ( $is_demo ) ? 'subscriber' : 'editor'; //$default_options[ 'wpbm_user_role_settings' ] = ( $is_demo ) ? 'subscriber' : 'editor'; // Position // Uninstall $default_options[ 'wpbm_is_delete_if_deactive' ] = ($is_demo) ? 'On' : 'Off'; $default_options[ 'wpbm_is_hide_details' ] = 'Off'; //FixIn: 2.0.12.3 $default_options[ 'wpbm_listing_template' ] = '
' . "\n" . '
[DATES]
' . "\n" . '
' . "\n" . '

[SUMMARY]

[UID]' . "\n" . '

[DESCRIPTION]

' . "\n" . '
' . "\n" . '
' . "\n" . '
' . "\n" . '
'; if ( ! empty( $option_name ) ) { if ( isset( $default_options[ $option_name ] ) ) return $default_options[ $option_name ]; // Return 1 option else return false; // Option does NOT exist } else { return $default_options; // Return ALL } }