eturn bool Whether the style has been registered. True on success, false on failure. */ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return wp_styles()->add( $handle, $src, $deps, $ver, $media ); } /** * Removes a registered stylesheet. * * @see WP_Dependencies::remove() * * @since 2.1.0 * * @param string $handle Name of the stylesheet to be removed. */ function wp_deregister_style( $handle ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); wp_styles()->remove( $handle ); } /** * Enqueues a CSS stylesheet. * * Registers the style if source provided (does NOT overwrite) and enqueues. * * @see WP_Dependencies::add() * @see WP_Dependencies::enqueue() * @link https://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. * * @since 2.6.0 * * @param string $handle Name of the stylesheet. Should be unique. * @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory. * Default empty. * @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array. * @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL * as a query string for cache busting purposes. If version is set to false, a version * number is automatically added equal to current installed WordPress version. * If set to null, no version is added. * @param string $media Optional. The media for which this stylesheet has been defined. * Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like * '(orientation: portrait)' and '(max-width: 640px)'. */ function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $wp_styles = wp_styles(); if ( $src ) { $_handle = explode( '?', $handle ); $wp_styles->add( $_handle[0], $src, $deps, $ver, $media ); } $wp_styles->enqueue( $handle ); } /** * Removes a previously enqueued CSS stylesheet. * * @see WP_Dependencies::dequeue() * * @since 3.1.0 * * @param string $handle Name of the stylesheet to be removed. */ function wp_dequeue_style( $handle ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); wp_styles()->dequeue( $handle ); } /** * Checks whether a CSS stylesheet has been added to the queue. * * @since 2.8.0 * * @param string $handle Name of the stylesheet. * @param string $status Optional. Status of the stylesheet to check. Default 'enqueued'. * Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'. * @return bool Whether style is queued. */ function wp_style_is( $handle, $status = 'enqueued' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return (bool) wp_styles()->query( $handle, $status ); } /** * Adds metadata to a CSS stylesheet. * * Works only if the stylesheet has already been registered. * * Possible values for $key and $value: * 'conditional' string Comments for IE 6, lte IE 7 etc. * 'rtl' bool|string To declare an RTL stylesheet. * 'suffix' string Optional suffix, used in combination with RTL. * 'alt' bool For rel="alternate stylesheet". * 'title' string For preferred/alternate stylesheets. * 'path' string The absolute path to a stylesheet. Stylesheet will * load inline when 'path' is set. * * @see WP_Dependencies::add_data() * * @since 3.6.0 * @since 5.8.0 Added 'path' as an official value for $key. * See {@see wp_maybe_inline_styles()}. * * @param string $handle Name of the stylesheet. * @param string $key Name of data point for which we're storing a value. * Accepts 'conditional', 'rtl' and 'suffix', 'alt', 'title' and 'path'. * @param mixed $value String containing the CSS data to be added. * @return bool True on success, false on failure. */ function wp_style_add_data( $handle, $key, $value ) { return wp_styles()->add_data( $handle, $key, $value ); } => ! empty( $term->title ) ? $term->title : aioseo()->meta->title->getTaxonomyTitle( $taxonomy->taxonomy ), 'description' => ! empty( $term->description ) ? $term->description : aioseo()->meta->description->getTaxonomyDescription( $taxonomy->taxonomy ), 'keywords' => ! empty( $term->keywords ) ? $term->keywords : wp_json_encode( [] ), 'type' => get_taxonomy( $screen->taxonomy )->labels->singular_name, 'termType' => 'type' === $screen->taxonomy ? '_aioseo_type' : $screen->taxonomy, 'canonicalUrl' => $term->canonical_url, 'default' => ( (int) $term->robots_default ) === 0 ? false : true, 'noindex' => ( (int) $term->robots_noindex ) === 0 ? false : true, 'noarchive' => ( (int) $term->robots_noarchive ) === 0 ? false : true, 'nosnippet' => ( (int) $term->robots_nosnippet ) === 0 ? false : true, 'nofollow' => ( (int) $term->robots_nofollow ) === 0 ? false : true, 'noimageindex' => ( (int) $term->robots_noimageindex ) === 0 ? false : true, 'noodp' => ( (int) $term->robots_noodp ) === 0 ? false : true, 'notranslate' => ( (int) $term->robots_notranslate ) === 0 ? false : true, 'maxSnippet' => null === $term->robots_max_snippet ? -1 : (int) $term->robots_max_snippet, 'maxVideoPreview' => null === $term->robots_max_videopreview ? -1 : (int) $term->robots_max_videopreview, 'maxImagePreview' => $term->robots_max_imagepreview, 'modalOpen' => false, 'generalMobilePrev' => false, 'og_object_type' => ! empty( $term->og_object_type ) ? $term->og_object_type : 'default', 'og_title' => $term->og_title, 'og_description' => $term->og_description, 'og_image_custom_url' => $term->og_image_custom_url, 'og_image_custom_fields' => $term->og_image_custom_fields, 'og_image_type' => ! empty( $term->og_image_type ) ? $term->og_image_type : 'default', 'og_video' => ! empty( $term->og_video ) ? $term->og_video : '', 'og_article_section' => ! empty( $term->og_article_section ) ? $term->og_article_section : '', 'og_article_tags' => ! empty( $term->og_article_tags ) ? $term->og_article_tags : wp_json_encode( [] ), 'twitter_use_og' => ( (int) $term->twitter_use_og ) === 0 ? false : true, 'twitter_card' => $term->twitter_card, 'twitter_image_custom_url' => $term->twitter_image_custom_url, 'twitter_image_custom_fields' => $term->twitter_image_custom_fields, 'twitter_image_type' => $term->twitter_image_type, 'twitter_title' => $term->twitter_title, 'twitter_description' => $term->twitter_description, 'redirects' => [ 'modalOpen' => false ] ]; if ( ! $term->exists() ) { $this->data['currentPost'] = array_merge( $this->data['currentPost'], aioseo()->migration->meta->getMigratedTermMeta( $termId ) ); } } /** * Set Vue seo revisions data. * * @since 4.4.9 * * @return void */ private function setSeoRevisionsData() { if ( aioseo()->helpers->isScreenBase( 'term' ) ) { $this->data['seoRevisions'] = aioseo()->seoRevisions->getVueDataEdit(); } } /** * Set Vue post data. * * @since 4.4.9 * * @return void */ private function setPostData() { if ( 'post' !== $this->args['page'] ) { return; } $postId = $this->args['staticPostId'] ?: get_the_ID(); $aioseoPost = CommonModels\Post::getPost( $postId ); $wpPost = get_post( $postId ); if ( is_object( $wpPost ) ) { $this->data['currentPost']['defaultSchemaType'] = ''; $this->data['currentPost']['defaultWebPageType'] = ''; $dynamicOptions = aioseo()->dynamicOptions->noConflict(); if ( $dynamicOptions->searchAppearance->postTypes->has( $wpPost->post_type ) ) { $this->data['currentPost']['defaultSchemaType'] = $dynamicOptions->searchAppearance->postTypes->{$wpPost->post_type}->schemaType; $this->data['currentPost']['defaultWebPageType'] = $dynamicOptions->searchAppearance->postTypes->{$wpPost->post_type}->webPageType; } } $clonedSchema = json_decode( wp_json_encode( $this->data['currentPost']['schema'] ) ); $this->data['schema']['output'] = aioseo()->schema->getValidatorOutput( $postId, $clonedSchema->graphs, $clonedSchema->blockGraphs, $clonedSchema->default, $clonedSchema->blockGraphs ); $this->data['currentPost']['open_ai'] = ! empty( $aioseoPost->open_ai ) ? CommonModels\Post::getDefaultOpenAiOptions( $aioseoPost->open_ai ) : CommonModels\Post::getDefaultOpenAiOptions(); $this->data['currentPost']['primary_term'] = ! empty( $aioseoPost->primary_term ) ? $aioseoPost->primary_term : []; } /** * Set Vue product/download data. * * @since 4.4.9 * * @return void */ private function setProductData() { $wpPost = $this->getPost(); if ( ! $wpPost || ! in_array( $wpPost->post_type, [ 'product', 'download' ], true ) ) { return; } $isWooCommerceActive = $this->isWooCommerceActive(); $isEddActive = $this->isEddActive(); $this->data['data'] += [ 'isWooCommerceActive' => $isWooCommerceActive, 'isEddActive' => $isEddActive ]; if ( $isWooCommerceActive ) { $product = wc_get_product( $wpPost->ID ); if ( ! is_a( $product, 'WC_Product' ) ) { return; } $this->data['data']['wooCommerce'] = [ 'currencySymbol' => function_exists( 'get_woocommerce_currency_symbol' ) ? get_woocommerce_currency_symbol() : '$', 'isPerfectBrandsActive' => $this->isPerfectBrandsActive(), 'isWooCommerceBrandsActive' => $this->isWooCommerceBrandsActive(), 'isWooCommerceUpcEanIsbnActive' => $this->isWooCommerceUpcEanIsbnActive(), 'reviewsEnabled' => $product->get_reviews_allowed() ]; } if ( $isEddActive ) { $this->data['data']['edd']['isEddReviewsActive'] = $this->isEddReviewsActive(); } } /** * Set Vue tools or settings data. * * @since 4.4.9 * * @return void */ private function setToolsOrSettingsData() { if ( 'tools' !== $this->args['page'] && 'settings' !== $this->args['page'] ) { return; } if ( 'settings' === $this->args['page'] ) { $this->data['breadcrumbs']['defaultTemplates'] = []; $postTypes = aioseo()->helpers->getPublicPostTypes(); foreach ( $postTypes as $postType ) { if ( 'type' === $postType['name'] ) { $postType['name'] = '_aioseo_type'; } // phpcs:ignore Generic.Files.LineLength.MaxExceeded $this->data['breadcrumbs']['defaultTemplates']['postTypes'][ $postType['name'] ] = aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'single', $postType ) ); } $taxonomies = aioseo()->helpers->getPublicTaxonomies(); foreach ( $taxonomies as $taxonomy ) { if ( 'type' === $taxonomy['name'] ) { $taxonomy['name'] = '_aioseo_type'; } // phpcs:ignore Generic.Files.LineLength.MaxExceeded $this->data['breadcrumbs']['defaultTemplates']['taxonomies'][ $taxonomy['name'] ] = aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'taxonomy', $taxonomy ) ); } $this->data['breadcrumbs']['defaultTemplates']['archives'] = [ 'blog' => aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'blog' ) ), 'author' => aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'author' ) ), 'search' => aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'search' ) ), 'notFound' => aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'notFound' ) ), 'date' => [ 'year' => aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'year' ) ), 'month' => aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'month' ) ), 'day' => aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'day' ) ) ] ]; $archives = aioseo()->helpers->getPublicPostTypes( false, true, true ); foreach ( $archives as $archive ) { // phpcs:ignore Generic.Files.LineLength.MaxExceeded $this->data['breadcrumbs']['defaultTemplates']['archives']['postTypes'][ $archive['name'] ] = aioseo()->helpers->encodeOutputHtml( aioseo()->breadcrumbs->frontend->getDefaultTemplate( 'postTypeArchive', $archive ) ); } $this->data['searchStatistics']['isConnected'] = aioseo()->searchStatistics->api->auth->isConnected(); } if ( 'tools' === $this->args['page'] && is_multisite() && is_network_admin() && aioseo()->license->hasCoreFeature( 'tools', 'network-tools-import-export' ) ) { foreach ( aioseo()->helpers->getSites()['sites'] as $site ) { aioseo()->helpers->switchToBlog( $site->blog_id ); $this->data['data']['network']['backups'][ $site->blog_id ] = array_reverse( aioseo()->backup->all() ); } aioseo()->helpers->restoreCurrentBlog(); } } /** * We may need to force a check for plugin updates. * * @since 4.1.6 * * @return void */ private function maybeCheckForPluginUpdates() { // If we aren't on one of the addon pages, return early. if ( ! in_array( $this->args['page'], [ 'feature-manager', 'link-assistant', 'local-seo', 'redirects', 'search-appearance', 'sitemaps' ], true ) ) { return; } $shouldCheckForUpdates = false; // Loop through all addons and see if the addon needing an update matches the current page. foreach ( aioseo()->addons->getAddons() as $addon ) { if ( $addon->hasMinimumVersion ) { continue; } if ( 'feature-manager' === $this->args['page'] ) { $shouldCheckForUpdates = true; continue; } if ( 'aioseo-' . $this->args['page'] === $addon->sku ) { $shouldCheckForUpdates = true; continue; } if ( 'sitemaps' === $this->args['page'] && in_array( $addon->sku, [ 'aioseo-video-sitemap', 'aioseo-news-sitemap' ], true ) ) { $shouldCheckForUpdates = true; } } // We want to force checks for updates, so let's go ahead and do that now. if ( $shouldCheckForUpdates ) { delete_site_transient( 'update_plugins' ); } } /** * Clean sensitive data. * * @since 4.5.3 * * @return void */ private function cleanSensitiveData() { // If the user is an admin, we don't need to clean the data. if ( aioseo()->access->isAdmin() ) { return; } // Check for the license key and override it with a placeholder. if ( ! empty( $this->data['options']['general']['licenseKey'] ) ) { $this->data['options']['general']['licenseKey'] = '*****************'; } if ( ! empty( $this->data['networkOptions']['general']['licenseKey'] ) ) { $this->data['networkOptions']['general']['licenseKey'] = '*****************'; } } }