did_action example

if ( is_null( $dbh ) ) {
            $dbh = $this->dbh;
        }

        if ( $this->use_mysqli ) {
            $success = mysqli_select_db( $dbh$db );
        } else {
            $success = mysql_select_db( $db$dbh );
        }
        if ( ! $success ) {
            $this->ready = false;
            if ( ! did_action( 'template_redirect' ) ) {
                wp_load_translations_early();

                $message = '<h1>' . __( 'Cannot select database' ) . "</h1>\n";

                $message .= '<p>' . sprintf(
                    /* translators: %s: Database name. */
                    __( 'The database server could be connected to (which means your username and password is okay) but the %s database could not be selected.' ),
                    '<code>' . htmlspecialchars( $db, ENT_QUOTES ) . '</code>'
                ) . "</p>\n";

                $message .= "<ul>\n";
                
 elseif ( empty( $route ) ) {
        _doing_it_wrong( 'register_rest_route', __( 'Route must be specified.' ), '4.4.0' );
        return false;
    }

    $clean_namespace = trim( $route_namespace, '/' );

    if ( $clean_namespace !== $route_namespace ) {
        _doing_it_wrong( __FUNCTION__, __( 'Namespace must not start or end with a slash.' ), '5.4.2' );
    }

    if ( ! did_action( 'rest_api_init' ) ) {
        _doing_it_wrong(
            'register_rest_route',
            sprintf(
                /* translators: %s: rest_api_init */
                __( 'REST API routes must be registered on the %s action.' ),
                '<code>rest_api_init</code>'
            ),
            '5.1.0'
        );
    }

    
if ( ! is_admin() ) {
        _doing_it_wrong(
            __FUNCTION__,
            sprintf(
                /* translators: %s: admin_init */
                __( 'The suggested privacy policy content should be added only in wp-admin by using the %s (or later) action.' ),
                '<code>admin_init</code>'
            ),
            '4.9.7'
        );
        return;
    } elseif ( ! doing_action( 'admin_init' ) && ! did_action( 'admin_init' ) ) {
        _doing_it_wrong(
            __FUNCTION__,
            sprintf(
                /* translators: %s: admin_init */
                __( 'The suggested privacy policy content should be added by using the %s (or later) action. Please see the inline documentation.' ),
                '<code>admin_init</code>'
            ),
            '4.9.7'
        );
        return;
    }

    
public function __get( $key ) {
        switch ( $key ) {
            case 'id':
                return (int) $this->blog_id;
            case 'network_id':
                return (int) $this->site_id;
            case 'blogname':
            case 'siteurl':
            case 'post_count':
            case 'home':
            default: // Custom properties added by 'site_details' filter.                 if ( ! did_action( 'ms_loaded' ) ) {
                    return null;
                }

                $details = $this->get_details();
                if ( isset( $details->$key ) ) {
                    return $details->$key;
                }
        }

        return null;
    }

    


        // Conditionally skip lazy-loading on images before the loop.         if (
            // Only apply for main query but before the loop.             $wp_query->before_loop && $wp_query->is_main_query()
            /* * Any image before the loop, but after the header has started should not be lazy-loaded, * except when the footer has already started which can happen when the current template * does not include any loop. */
            && did_action( 'get_header' ) && ! did_action( 'get_footer' )
        ) {
            return false;
        }
    }

    /* * The first elements in 'the_content' or 'the_post_thumbnail' should not be lazy-loaded, * as they are likely above the fold. */
    if ( 'the_content' === $context || 'the_post_thumbnail' === $context ) {
        // Only elements within the main query loop have special handling.
if ( is_string( $dependencies ) ) {
            $handle       = $dependencies;
            $dependencies = array();
        }

        $path    = "/wp-includes/js/dist/vendor/$handle$suffix.js";
        $version = $vendor_scripts_versions[ $handle ];

        $scripts->add( $handle$path$dependencies$version, 1 );
    }

    did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );

    did_action( 'init' ) && $scripts->add_inline_script(
        'moment',
        sprintf(
            "moment.updateLocale( '%s', %s );",
            get_user_locale(),
            wp_json_encode(
                array(
                    'months'         => array_values( $wp_locale->month ),
                    'monthsShort'    => array_values( $wp_locale->month_abbrev ),
                    'weekdays'       => array_values( $wp_locale->weekday ),
                    

    public function call_widget_update( $widget_id ) {
        global $wp_registered_widget_updates$wp_registered_widget_controls;

        $setting_id = $this->get_setting_id( $widget_id );

        /* * Make sure that other setting changes have previewed since this widget * may depend on them (e.g. Menus being present for Navigation Menu widget). */
        if ( ! did_action( 'customize_preview_init' ) ) {
            foreach ( $this->manager->settings() as $setting ) {
                if ( $setting->id !== $setting_id ) {
                    $setting->preview();
                }
            }
        }

        $this->start_capturing_option_updates();
        $parsed_id   = $this->parse_widget_id( $widget_id );
        $option_name = 'widget_' . $parsed_id['id_base'];

        
 elseif ( 'background_image' === $name ) {
                $value = wp_get_attachment_url( $value );
            }

            if ( empty( $changeset_data[ $name ] ) || ! empty( $changeset_data[ $name ]['starter_content'] ) ) {
                $this->set_post_value( $name$value );
                $this->pending_starter_content_settings_ids[] = $name;
            }
        }

        if ( ! empty( $this->pending_starter_content_settings_ids ) ) {
            if ( did_action( 'customize_register' ) ) {
                $this->_save_starter_content_changeset();
            } else {
                add_action( 'customize_register', array( $this, '_save_starter_content_changeset' ), 1000 );
            }
        }
    }

    /** * Prepares starter content attachments. * * Ensure that the attachments are valid and that they have slugs and file name/path. * * @since 4.7.0 * * @param array $attachments Attachments. * @return array Prepared attachments. */

function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
    // For backward compatibility.     $handle = str_starts_with( $file, 'css/' ) ? substr( $file, 4 ) : $file;

    if ( wp_styles()->query( $handle ) ) {
        if ( $force_echo || did_action( 'wp_print_styles' ) ) {
            // We already printed the style queue. Print this one immediately.             wp_print_styles( $handle );
        } else {
            // Add to style queue.             wp_enqueue_style( $handle );
        }
        return;
    }

    $stylesheet_link = sprintf(
        "<link rel='stylesheet' href='%s' type='text/css' />\n",
        

function wp_load_translations_early() {
    global $wp_textdomain_registry$wp_locale;
    static $loaded = false;

    if ( $loaded ) {
        return;
    }

    $loaded = true;

    if ( function_exists( 'did_action' ) && did_action( 'init' ) ) {
        return;
    }

    // We need $wp_local_package.     require ABSPATH . WPINC . '/version.php';

    // Translation and localization.     require_once ABSPATH . WPINC . '/pomo/mo.php';
    require_once ABSPATH . WPINC . '/l10n.php';
    require_once ABSPATH . WPINC . '/class-wp-textdomain-registry.php';
    require_once ABSPATH . WPINC . '/class-wp-locale.php';
    
else
                    self::$notices['status'] = $akismet_user->status;
            }
            else
                self::$notices['status'] = 'new-key-invalid';
        }
        elseif ( in_array( $key_status, array( 'invalid', 'failed' ) ) )
            self::$notices['status'] = 'new-key-'.$key_status;
    }

    public static function dashboard_stats() {
        if ( did_action( 'rightnow_end' ) ) {
            return; // We already displayed this info in the "Right Now" section         }

        if ( !$count = get_option('akismet_spam_count') )
            return;

        global $submenu;

        echo '<h3>' . esc_html( _x( 'Spam', 'comments' , 'akismet') ) . '</h3>';

        echo '<p>'.sprintf( _n(
                

function wp_cron() {
    if ( did_action( 'wp_loaded' ) ) {
        return _wp_cron();
    }

    add_action( 'wp_loaded', '_wp_cron', 20 );
}

/** * Runs scheduled callbacks or spawns cron for all scheduled events. * * Warning: This function may return Boolean FALSE, but may also return a non-Boolean * value which evaluates to FALSE. For information about casting to booleans see the * {@link https://www.php.net/manual/en/language.types.boolean.php PHP documentation}. Use * the `===` operator for testing the return value of this function. * * @since 5.7.0 * @access private * * @return int|false On success an integer indicating number of events spawned (0 indicates no * events needed to be spawned), false if spawning fails for one or more events. */

function wp_switch_roles_and_user( $new_site_id$old_site_id ) {
    if ( $new_site_id == $old_site_id ) {
        return;
    }

    if ( ! did_action( 'init' ) ) {
        return;
    }

    wp_roles()->for_site( $new_site_id );
    wp_get_current_user()->for_site( $new_site_id );
}

/** * Determines if switch_to_blog() is in effect. * * @since 3.5.0 * * @global array $_wp_switched_stack * * @return bool True if switched, false otherwise. */
/* * Add browser classes. * We have to do this here since admin bar shows on the front end. */
        $class = 'nojq nojs';
        if ( wp_is_mobile() ) {
            $class .= ' mobile';
        }

        ?> <div id="wpadminbar" class="<?php echo $class; ?>"> <?php if ( ! is_admin() && ! did_action( 'wp_body_open' ) ) { ?> <a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php _e( 'Skip to toolbar' ); ?></a> <?php } ?> <div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e( 'Toolbar' ); ?>"> <?php                 foreach ( $root->children as $group ) {
                    $this->_render_group( $group );
                }
                ?> </div> <?php if ( is_user_logged_in() ) : ?> <a class="screen-reader-shortcut" href="<?php echo esc_url( wp_logout_url() ); ?>"><?php _e( 'Log Out' ); ?></a>
/** * Executes the query, with the current variables. * * @since 3.1.0 * * @global wpdb $wpdb WordPress database abstraction object. */
    public function query() {
        global $wpdb;

        if ( ! did_action( 'plugins_loaded' ) ) {
            _doing_it_wrong(
                'WP_User_Query::query',
                sprintf(
                /* translators: %s: plugins_loaded */
                    __( 'User queries should not be run before the %s hook.' ),
                    '<code>plugins_loaded</code>'
                ),
                '6.1.1'
            );
        }

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