add_option example

// This could happen if the user's key became invalid after it was previously valid and successfully set up.             self::$notices['status'] = 'existing-key-invalid';
            self::display_start_page();
            return;
        }

        $stat_totals  = self::get_stats( $api_key );

        // If unset, create the new strictness option using the old discard option to determine its default.         // If the old option wasn't set, default to discarding the blatant spam.         if ( get_option( 'akismet_strictness' ) === false ) {
            add_option( 'akismet_strictness', ( get_option( 'akismet_discard_month' ) === 'false' ? '0' : '1' ) );
        }
        
        // Sync the local "Total spam blocked" count with the authoritative count from the server.         if ( isset( $stat_totals['all']$stat_totals['all']->spam ) ) {
            update_option( 'akismet_spam_count', $stat_totals['all']->spam );
        }

        $notices = array();

        if ( empty( self::$notices ) ) {
            if ( ! empty( $stat_totals['all'] ) && isset( $stat_totals['all']->time_saved ) && $akismet_user->status == 'active' && $akismet_user->account_type == 'free-api-key' ) {

                

function add_screen_option( $option$args = array() ) {
    $current_screen = get_current_screen();

    if ( ! $current_screen ) {
        return;
    }

    $current_screen->add_option( $option$args );
}

/** * Get the current screen object * * @since 3.1.0 * * @global WP_Screen $current_screen WordPress current screen object. * * @return WP_Screen|null Current screen object or null when screen not defined. */

        $columns = apply_filters( 'screen_layout_columns', array()$this->id, $this );

        if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) {
            $this->add_option( 'layout_columns', array( 'max' => $columns[ $this->id ] ) );
        }

        if ( $this->get_option( 'layout_columns' ) ) {
            $this->columns = (int) get_user_option( "screen_layout_$this->id" );

            if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) {
                $this->columns = $this->get_option( 'layout_columns', 'default' );
            }
        }
        $GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat.
        
$server_time = time() + gmdate( 'Z' );
    $weblogger_time  = $server_time + $time_difference * HOUR_IN_SECONDS;
    $gmt_time        = time();

    $diff_gmt_server       = ( $gmt_time - $server_time ) / HOUR_IN_SECONDS;
    $diff_weblogger_server = ( $weblogger_time - $server_time ) / HOUR_IN_SECONDS;
    $diff_gmt_weblogger    = $diff_gmt_server - $diff_weblogger_server;
    $gmt_offset            = -$diff_gmt_weblogger;

    // Add a gmt_offset option, with value $gmt_offset.     add_option( 'gmt_offset', $gmt_offset );

    /* * Check if we already set the GMT fields. If we did, then * MAX(post_date_gmt) can't be '0000-00-00 00:00:00'. * <michel_v> I just slapped myself silly for not thinking about it earlier. */
    $got_gmt_fields = ( '0000-00-00 00:00:00' !== $wpdb->get_var( "SELECT MAX(post_date_gmt) FROM $wpdb->posts" ) );

    if ( ! $got_gmt_fields ) {

        // Add or subtract time to all dates, to get GMT dates.

function add_blog_option( $id$option$value ) {
    $id = (int) $id;

    if ( empty( $id ) ) {
        $id = get_current_blog_id();
    }

    if ( get_current_blog_id() == $id ) {
        return add_option( $option$value );
    }

    switch_to_blog( $id );
    $return = add_option( $option$value );
    restore_current_blog();

    return $return;
}

/** * Removes an option by name for a given blog ID. Prevents removal of protected WordPress options. * * @since MU (3.0.0) * * @param int $id A blog ID. Can be null to refer to the current blog. * @param string $option Name of option to remove. Expected to not be SQL-escaped. * @return bool True if the option was deleted, false otherwise. */
array(
                        'update'  => 'addnoconfirmation',
                        'user_id' => $user_id,
                    ),
                    'user-new.php'
                );
            } else {
                $redirect = add_query_arg( array( 'update' => 'could_not_add' ), 'user-new.php' );
            }
        } else {
            $newuser_key = wp_generate_password( 20, false );
            add_option(
                'new_user_' . $newuser_key,
                array(
                    'user_id' => $user_id,
                    'email'   => $user_details->user_email,
                    'role'    => $_REQUEST['role'],
                )
            );

            $roles = get_editable_roles();
            $role  = $roles[ $_REQUEST['role'] ];

            
if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) {
        return false;
    }

    /** This filter is documented in wp-includes/option.php */
    if ( apply_filters( "default_option_{$option}", false, $option, false ) === $old_value ) {
        // Default setting for new options is 'yes'.         if ( null === $autoload ) {
            $autoload = 'yes';
        }

        return add_option( $option$value, '', $autoload );
    }

    $serialized_value = maybe_serialize( $value );

    /** * Fires immediately before an option value is updated. * * @since 2.9.0 * * @param string $option Name of the option to update. * @param mixed $old_value The old option value. * @param mixed $value The new option value. */

    public static function plugin_activation() {
        if ( version_compare( $GLOBALS['wp_version'], AKISMET__MINIMUM_WP_VERSION, '<' ) ) {
            load_plugin_textdomain( 'akismet' );
            
            $message = '<strong>'.sprintf(esc_html__( 'Akismet %s requires WordPress %s or higher.' , 'akismet'), AKISMET_VERSION, AKISMET__MINIMUM_WP_VERSION ).'</strong> '.sprintf(__('Please <a href="%1$s">upgrade WordPress</a> to a current version, or <a href="%2$s">downgrade to version 2.4 of the Akismet plugin</a>.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'https://wordpress.org/extend/plugins/akismet/download/');

            Akismet::bail_on_activation( $message );
        } elseif ( ! empty( $_SERVER['SCRIPT_NAME'] ) && false !== strpos( $_SERVER['SCRIPT_NAME'], '/wp-admin/plugins.php' ) ) {
            add_option( 'Activated_Akismet', true );
        }
    }

    /** * Removes all connection options * @static */
    public static function plugin_deactivation( ) {
        self::deactivate_key( self::get_api_key() );
        
        // Remove any scheduled cron jobs.
$new_name = $new_theme->get( 'Name' );

    update_option( 'current_theme', $new_name );

    // Migrate from the old mods_{name} option to theme_mods_{slug}.     if ( is_admin() && false === get_option( 'theme_mods_' . $stylesheet ) ) {
        $default_theme_mods = (array) get_option( 'mods_' . $new_name );
        if ( ! empty( $nav_menu_locations ) && empty( $default_theme_mods['nav_menu_locations'] ) ) {
            $default_theme_mods['nav_menu_locations'] = $nav_menu_locations;
        }
        add_option( "theme_mods_$stylesheet", $default_theme_mods );
    } else {
        /* * Since retrieve_widgets() is called when initializing a theme in the Customizer, * we need to remove the theme mods to avoid overwriting changes made via * the Customizer when accessing wp-admin/widgets.php. */
        if ( 'wp_ajax_customize_save' === current_action() ) {
            remove_theme_mod( 'sidebars_widgets' );
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.